Pesquisar

Are you looking for test card numbers?

Would you like to contact support?

Atenção, esta página não se encontra disponível em Português
Risk-management icon

Test a chargeback scenario

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

To verify your Disputes API integration, you can test a chargeback scenario. First, you create a test payment with a chargeback reason of your choice. Then, you capture that transaction and wait for the notification webhook. When you receive the notification, the chargeback is created and you can use the information from your test transaction to test the Disputes API.

If you're looking to test a Klarna dispute scenario, refer to Klarna dispute guidelines.

  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.

    For example, submit the /payments request below to simulate a chargeback with reason code 10.4:

    Payment request
     curl https://checkout-test.adyen.com/v67/payments
     -H 'x-api-key: YOUR_API_KEY' \
     -H 'content-type: application/json' \
     -d '{
       "amount": {
         "currency": "EUR",
         "value": 1000
       },
       "reference": "YOUR_ORDER_NUMBER",
       "{hint:If you are using the /authorise endpoint, change the object to card}paymentMethod{/hint}": {
         "type": "scheme",
         "encryptedCardNumber": "test_4111111111111111",
         "encryptedExpiryMonth": "test_03",
         "encryptedExpiryYear": "test_2030",
         "encryptedSecurityCode": "test_737",
         "holderName": "chargeback:10.4"
       },
       "returnUrl": "https://your-company.com/...",
       "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
       }'

    You receive a response containing pspReference, our unique identifier for the payment.

  2. Capture the payment with a /payments/{paymentPspReference}/captures request, specifying:

    • paymentPspReference: The pspReference of the payment you're capturing.
    • amount: The value and currency specified in the payment request.
    Capture request
     curl https://checkout-test.adyen.com/v67/payments/{paymentPspReference}/captures \
     -H 'x-api-key: YOUR_API_KEY' \
     -H 'content-type: application/json' \
     -d '{
           "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
           "amount": {
               "currency": "EUR",
               "value": 1000
           },
             "reference": "YOUR_UNIQUE_REFERENCE"
     }'

    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 notification. In this example, you will receive a NOTIFICATION_OF_CHARGEBACK. This notification contains a pspReference, which is the unique identifier for the dispute. For example:

    {
    "live":"false",
    "notificationItems":[
      {
         "NotificationRequestItem":{
            "additionalData":{
               "chargebackReasonCode":"10.4",
               "modificationMerchantReferences":"",
               "chargebackSchemeCode":"visa",
               "defensePeriodEndsAt":"2021-11-29T01:30:57+01:00",
               "autoDefended":"false",
               "defendable" : "true",
               "disputeStatus":"Undefended"
            },
            "amount":{
               "currency":"EUR",
               "value":1000
            },
            "eventCode":"NOTIFICATION_OF_CHARGEBACK",
            "eventDate":"2021-11-11T01:30:57+01:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "merchantReference":"YOUR_REFERENCE",
            "originalReference":"8515785619639602",
            "paymentMethod":"visa",
            "pspReference":"9915555555555555",
            "reason":"Other Fraud-Card Absent Environment",
            "success":"true"
          }
        }
      ]
    }
  4. After the chargeback is created, use the Disputes API and follow the steps to retrieve defense reasons request, upload dispute defense documents, and defend the dispute.