Skip to main content

Test your in-person payments integration

See Simulating declined payments to learn about triggering refusal reasons with an in-person payments integration. You can test how your integration can handle different responses to make sure your integration can handle failure scenarios. In such scenarios, you receive a result code and a refusal reason that tells you why a payment request did not succeed. You can trigger specific refusal reasons in your payment requests to test how your integration handles failure scenarios.

Benefits of testing refusal reasons

This page describes how to trigger specific refusal reasons in your payment requests and test unhappy scenarios. There are several benefits to making sure your integration can handle unhappy flows, for example:
  • Presenting your shoppers with specific error messages per refusal reason.
  • Ensuring that you have a retry logic to handle refused payments.
  • Building your order management system logic to make sure unhappy scenarios are handled correctly.

Trigger a refusal reason in a payment request

To get a specific result code and refusal reason in the /payments response, you need to include a specific value either in the holderName or RequestedTestAcquirerResponseCode field. You can find the values to use in the Values for testing refusal reasons table.
  1. In the table, select the refusal reason that you want to trigger.
  2. Make a /payments request, setting either of the following fields to the value corresponding to the refusal reason you want to trigger:
    • paymentMethod.holderName Some card-related payment methods, for example Alipay, redirect you to a simulator where you can select the payment result. In this case, the value provided as the cardholder name will be ignored.
    • additionalData.RequestedTestAcquirerResponseCode
    For example, to test getting resultCode: Refused with refusalReason: ExpiredCard, make one of the following requests.
Test request using holder name