Test Mode: OpayoPiOwnForm uses the live url to tokenize card details.

Created on 21 February 2024, 9 months ago
Updated 26 March 2024, 8 months ago

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
🐛 Bug report
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom hiraethmarkb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hiraethmarkb
  • 🇬🇧United Kingdom mwjansen Bristol

    Either there's an issue with test vs live 'mode' in the back-end or it might be a caching issue in the browser.

    I've pushed a commit that adds some logging of the 'mode' to the verbose logging.
    You should see an additional line in the console log - just before the javascript goes and contacts Opayo about tokenisation.
    There's also an additional line to the back-end log, something like
    PaymentMethodAddForm::buildOpayoPiOwnForm - mode: test, log level: 10

    Could you replace the 2 files, test again and let me know the log results

  • 🇬🇧United Kingdom mwjansen Bristol

    There's a 'beta6' release now that has the added verbose debug lines.
    Also a fix to the code dealing with 3DS result for anonymous users.

  • Status changed to Needs review 9 months ago
  • 🇬🇧United Kingdom mwjansen Bristol

    I've just tested the 'beta8' release against the Opayo live server on one of my setups and the transaction went through fine.

  • 🇬🇧United Kingdom mwjansen Bristol
  • Status changed to Closed: cannot reproduce 8 months ago
Production build 0.71.5 2024