Problem/Motivation
While testing using 'OpayoPiOwnForm' form with the Opayo test cards numbers (https://developer.elavon.com/products/opayo/v1/api-reference#tag/Test-Ca...) to gather payment details, payment fails with the following error:
HTTP error code: 422, first error (code: 1008): The card is not supported
Reviewing the browser console logs (with 'Extra Verbose Debugging Info' enabled), would appear to suggest that the live url is being used to tokenize the card details instead of the test url.
Excerpt from browser console logs (potentially sensitive details redacted, and empahsis added):
OpayoPiOwnForm.addSubmitEventListener called opayo-pi-ownform.js:423:15
OpayoPiOwnForm.addSubmitEventListener checkoutFormButtonClickEvent listener added opayo-pi-ownform.js:423:15
OpayoPiOwnForm.addSubmitEventListener completed opayo-pi-ownform.js:423:15
OpayoPiOwnForm - no payment method choice detected, assume single Opayo Pi payment method opayo-pi-ownform.js:423:15
OpayoPiOwnForm.checkoutFormButtonClickEvent form submit clicked with Opayo Pi payment method opayo-pi-ownform.js:423:15
OpayoPiOwnForm form submit button clicked, form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm request merchant session key using URL: /commerce_opayo_pi/merchantsessionkey/24/tokenize_and_submit, form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm request merchant session key sent (URL: /commerce_opayo_pi/merchantsessionkey/24/tokenize_and_submit), form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm - Ajax command opayoMerchantSessionKey: returned merchant session key: [SESSION_KEY], expiry: 2024-02-21T12:47:19.348Z, instruction: tokenize_and_submit, form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm.callCardDetailTokenisation: about to call sagepayOwnForm.tokeniseCardDetails with merchant session key: 2[SESSION_KEY] for card: ************0009, form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm.callCardDetailTokenisation: called sagepayOwnForm.tokeniseCardDetails with merchant session key: [SESSION_KEY], form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
XHRPOST
<strong>https://live.opayo.eu.elavon.com/api/v1/card-identifiers</strong>
[HTTP/1.1 422 Unprocessable Entity 256ms]
No headers for this request
Navigated to https://cigarbox.ddev.site:441/checkout/24/order_information
OpayoPiOwnForm.cardDetailsTokenised result: false, merchant session key used: [SESSION_KEY], form build id: form-naFJbQvKUBf6ExRw775DDTotD7KpJhkqGLPHULF9m9I opayo-pi-ownform.js:423:15
OpayoPiOwnForm.cardDetailsTokenised set card identifier result to: false opayo-pi-ownform.js:423:15
OpayoPiOwnForm.cardDetailsTokenised failed response processed - about to submit form, HTTP error code: 422, first error (code: 1008): The card is not supported opayo-pi-ownform.js:423:15
OpayoPiOwnForm.cardDetailsTokenised failed response processed - form submitted opayo-pi-ownform.js:423:15
OpayoPiOwnForm.addSubmitEventListener called opayo-pi-ownform.js:423:15
OpayoPiOwnForm.addSubmitEventListener checkoutFormButtonClickEvent listener added opayo-pi-ownform.js:423:15
OpayoPiOwnForm.addSubmitEventListener completed opayo-pi-ownform.js:423:15
OpayoPiOwnForm - no payment method choice detected, assume single Opayo Pi payment method opayo-pi-ownform.js:423:15
Steps to reproduce
- Go to the Opayo Pi payment gateway settings (admin/commerce/config/payment-gateways/manage/opayo_pi)
- Enable Test mode
- Enable the 'Use custom Commerce form - more customer-friendly checkout experience but higher PCI compliance (SAQ-A-EP) burden. (default)' form type.
- Add a product to the cart, and checkout using test card details