Risk-management icon

Test a chargeback scenario

Simulate chargebacks by submitting dispute reason codes in your payment request.

To test the dispute flow, you can simulate a chargeback and then make Disputes API calls to handle the simulated dispute, or test the process in your Customer Area.

Klarna dispute scenarios

To test Klarna disputes, refer to the Klarna dispute guidelines.

This is how it works:

  1. Create a test payment with a holderName value that triggers one of the chargeback scenarios that you can simulate.
  2. Capture the test payment.
  3. Wait for the webhook that indicates the simulated chargeback is created.
  4. Use the information from your test environment to test handling the chargeback using the Disputes API, or use your test Customer Area.

Test the dispute flow

  1. In your test environment, submit a payment request with the holderName set to any of the following values, depending on the scenario you want to simulate:

    • Chargeback:{reason_code}: A chargeback with a specific reason code. For a list of available reason codes, refer to Dispute reason codes.

      You may have to temporarily disable or lower the risk score for the Card/bank account holder name contains a non-alphabetic character risk check.

    • Chargeback: A chargeback without an explicit reason code.
    • Chargeback Reversed: A ChargebackReversed status without an explicit reason code.
    • Second Chargeback: A SecondChargeback status without an explicit reason code.

    The following example shows a /payments request to simulate a chargeback with reason code 10.4.

    You receive a response containing a pspReference, our unique identifier for the payment. You need this pspReference in the next step.

  2. To capture the test payment, make a /payments/{paymentPspReference}/captures request, where {paymentPspReference} is the pspReference you received in the payment response. Specify:

    • amount: The value and currency specified in the payment request.

    You receive a response containing:

    • pspReference: the PSP reference associated with this capture request. Note that this is different from the PSP reference associated with the original payment request.

    The payment will then go through SentforSettle, Settled, and finally the Chargeback status. This process can take up to 24 hours to complete.

  3. Wait for the webhook. In this example, you will receive a NOTIFICATION_OF_CHARGEBACK. This webhook contains a pspReference, which is the unique identifier for the dispute. For example:

  4. After the chargeback is created, you can use the Disputes API to handle the simulated dispute, or use your Customer Area.

    Using the Disputes API:

    1. Retrieve defense reasons
    2. Upload dispute defense documents
    3. Defend the dispute

    Using the Customer Area:

    1. Go to Risk > Disputes
    2. Select the simulated dispute and either accept or defend the dispute.