Click to Pay backend integration

Despite its name, processPayment() completes the Click to Pay checkout/token collection step but does not complete a payment. A successful response and a paymentInstrument.nonce do not mean that the customer's payment has been authorised or captured.

The end-to-end sequence is as follows:

  1. The browser calls ctpClient.processPayment() for the selected checkout action (Checkout with a saved card, new card to save to Click to Pay, or card not saved with Click to Pay).
  2. The browser sends the returned payment nonce and to your backend.
  3. Your backend submits a payment to BR-DGE using a server API key and the provided nonce.
  4. Your backend handles the payment result, including any required additional action, for example 3-DS, or pending outcome.

Example processPayment Response

For CHECKOUT_SAVED_CARD or ENROLL_AND_CHECKOUT, an illustrative resolved SDK result is shown below. This example assumes includeAuthenticationDetails: true was requested for a Mastercard card and the ECI value is fully authenticated (02).

{
  "status": "SUCCESS",
  "paymentInstrument": {
    "type": "clickToPay",
    "nonce": "55c34d2a-56cc-460b-8eee-97a991251d16"
  },
  "authenticationDetails": {
    "eci": "02",
    "verificationData": [
      {
        "verificationEntity": "03",
        "verificationEvents": [
          "01"
        ],
        "verificationType": "CARDHOLDER",
        "verificationResults": "01",
        "verificationMethod": "01",
        "verificationTimestamp": "1793285107149"
      }
    ]
  }
}
Response fieldDescription
statusIndicates whether the checkout step was successful or not. The payment has not yet been authorised or captured at this stage.
paymentInstrumentSend this object to your backend as the payment instrument; preserve the returned type and nonce.
paymentInstrument.nonceThe single-use BR-DGE identifier used for the backend payment submission, not a payment ID or approval.
authenticationDetailsOptional authentication information. It is omitted when not requested, and can be null when requested but unavailable.
authenticationDetails.eciInterpret using the card scheme's ECI values to determine whether to request 3-D Secure through BR-DGE or not.
authenticationDetails.verificationDataNetwork-provided verification details observed in this response.

The response field in the table above is the processPayment() response, not the response to POST /v1/payments. The REST payment response comes later, after your server submits the instrument to BR-DGE. TOKENIZE can return a different instrument type; forward the actual returned instrument rather than copying this example's clickToPay type.

Browser-to-server handoff

Submit the payment from your server using POST /v1/payments.

Your server must load the trusted order total, currency, and customer details and any other necessary details. Refer to the Create a payment API reference for the full request schema, including required and optional fields. Use the same environment and retail channel as the SDK that issued the nonce.

Example server-to-server request:

{
  "merchantTransactionId": "ORDER-123-ATTEMPT-1",
  "amount": 5000,
  "currencyCode": "GBP",
  "customerOrderCode": "ORDER-123",
  "orderDescription": "Order 123",
  "customerFirstName": "Alex",
  "customerLastName": "Miller",
  "customerEmail": "[email protected]",
  "paymentInstrument": {
    "type": "clickToPay",
    "nonce": "NONCE_FROM_PROCESS_PAYMENT"
  }
}

Authentication and additional actions

Use result.authenticationDetails.eci from processPayment()to help decide whether to request 3-D Secure from BR-DGE.

  • Fully authenticated (05 for Visa, 02 for Mastercard): submit the payment without threeDSecureRequired or threeDSecureOptions. BR-DGE extracts the existing 3DS results from the Click to Pay checkoutResponse and includes them in the payment sent to the processor. You do not need to construct an externalThreeDSecure object from the ECI.
  • 3DS not performed (07 for Visa, 00 for Mastercard): BR-DGE recommends the inclusion of "threeDSecureRequired": true in the POST /v1/payments body to complete 3DS through BR-DGE. Check with your PSP to ensure that your setup includes 3-D Secure.
  • Attempted or unknown: an attempted ECI (06 for Visa, 01 for Mastercard) is not fully authenticated. Treat a missing ECI as unknown and follow your agreed authentication policy for these cases.

When BR-DGE returns an additional action for 3DS, pass that action to the browser and handle it with the BR-DGE Post Response Module. Send the module's result back to your server to continue the existing payment. Completing the challenge is not itself payment approval; confirm the final payment outcome before showing success.

If you request 3DS when the Click to Pay checkout response already contains 3DS results, BR-DGE returns response code 4807: Payment has already been authenticated by 3DS. Avoid requesting authentication again for an already authenticated checkout.


Did this page help you?