--- title: "Test a chargeback scenario" description: "Simulate chargebacks by submitting dispute reason codes in your payment request." url: "https://docs.adyen.com/risk-management/disputes-api/test-applicable-dispute-reasons" source_url: "https://docs.adyen.com/risk-management/disputes-api/test-applicable-dispute-reasons.md" canonical: "https://docs.adyen.com/risk-management/disputes-api/test-applicable-dispute-reasons" last_modified: "2019-10-08T13:17:00+02:00" language: "en" --- # Test a chargeback scenario Simulate chargebacks by submitting dispute reason codes in your payment request. [View source](/risk-management/disputes-api/test-applicable-dispute-reasons.md) ##### Testing specific payment methods See the dedicated instructions to test chargeback scenarios for [ACH Direct Debit](/risk-management/chargeback-guidelines/ach-chargebacks#test-a-chargeback-scenario). To test the dispute flow, you can simulate different chargeback scenarios. You can then follow a simulated dispute through the process, and test how to defend or accept disputes using the Disputes API or the Customer Area. ## Requirements Before you begin, take into account the following requirements and limitations. | Requirement | Description | | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built an [online payments integration](/online-payments/build-your-integration/). | | **[API credentials](/development-resources/api-credentials/)** | To manage disputes using the Disputes API, make sure that you have an API credential with an API key and the **API dispute management** role. | | | | | **[Customer Area roles](/account/user-roles/#risk)** | To manage disputes using the Customer Area, make sure that you have one of the following role(s):- **Merchant dispute management** - **Risk admin** | | **[Webhooks](/development-resources/webhooks)** | Subscribe to the **Standard webhook** and [enable](/risk-management/disputes-api/dispute-notifications#dispute-webhooks-enable) dispute events. | | **Limitations** | Not all dispute types can be simulated. | | **Setup steps** | Decide if you want to test managing disputes with the [Disputes API](/risk-management/disputes-api/) or with the [Customer Area](/risk-management/manage-disputes/). For either flow, we recommend that you:- [Enable risk](/risk-management/configure-risk-settings/) and set up [risk management](/risk-management/). - If you are using RevenueProtect, our classic risk engine, temporarily disable or lower the risk score for the [Card/bank account holder name contains a non-alphabetic character](/risk-management/configure-manual-risk/standard-risk-rules#consistency-rules) risk check. | ## How it works The overall chargeback simulation and testing process is as follows: 1. Choose one of the [test scenarios](#dispute-test-scenarios). 2. [Make a test payment](#dispute-test-payment) with a `holderName` value that triggers the scenario that you want to simulate. 3. [Capture](#dispute-test-capture) the test payment. 4. Listen for the [webhook](#dispute-test-webhook) that indicates the simulated chargeback is created. 5. Use the information from your test environment to test [handling the chargeback](#dispute-test-handling) using the Disputes API or your test Customer Area. ## Test scenarios You can test the following chargeback scenarios: * A chargeback with a specific [chargeback reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1). * A chargeback without an explicit reason code. * A chargeback that is reversed without an explicit reason code. * A second chargeback without an explicit reason code. In your test payment request, you enter a value for the `holderName` that corresponds with the scenario that you want to test. You can test a chargeback scenario with the [same](#test-same) or with a [custom](#test-custom) value and or currency. ### Test a chargeback with the same value and currency To test a chargeback with the same value and currency as the payment request, use the following pattern for the `holderName`: * **Chargeback:{*reason\_code*}** * **Chargeback** * **Chargeback Reversed** * **Second Chargeback** For example test payment values, see the table with [example values](#test-example-values). ### Test a chargeback with a custom value and/or currency To test a custom value for full or partial chargebacks, or chargebacks for an amount that is greater than payment amount, in the same or in a different currency as the payment request, use the following pattern for the `holderName`: * **{chargeback scenario}** **{quantity in minor units}** **{currency code}** When you use this format, take into account the following limitations: * For partial chargebacks, the maximum difference between the chargeback and the test payment amount is 50 percent. * For chargebacks greater than payment amount, the maximum difference between the chargeback and the test payment amount is 20 percent. For example test payment values, see the table with [example test values](#test-example-values). ## Example test values The table shows example values that you can use in the test payment for the cardholder name and the amount in minor units, and which chargeback scenario it tests. | Test scenario | Example value `holderName` | Example value `amount` | Chargeback | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ---------------------- | ------------------------------- | | Test a chargeback with a specific [reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1). | **Chargeback:10.4** | Any | Full | | Test a chargeback with a specific [reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1) that has the same value and currency as the test payment. | **Chargeback:10.4 10000 EUR** | 10000 EUR | Full | | Test a partial chargeback with a specific [reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1) that has a lower value but the same currency as the test payment. | **Chargeback:10.4 9000 EUR** | 10000 EUR | Partial | | Test a chargeback with a specific [reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1) that has higher value but the same currency as the test payment. | **Chargeback:10.4 11000 EUR** | 10000 EUR | Greater than the payment amount | | Test a chargeback with a specific [reason code](/risk-management/understanding-disputes/dispute-reason-codes?tab=chargeback_1) in a currency that differs from the test payment. | **Chargeback:10.4 10000 USD** | 10000 EUR | Different currency | | Test a chargeback without an explicit reason code. | **Chargeback** | Any | Full | | Test a chargeback without an explicit reason code that has the same value and currency as the test payment. | **Chargeback 10000 EUR** | 10000 EUR | Full | | Test a partial chargeback without an explicit reason code that has a lower value but the same currency as the test payment. | **Chargeback 9000 EUR** | 10000 EUR | Partial | | Test a chargeback without an explicit reason code that has higher value but the same currency as the test payment. | **Chargeback 11000 EUR** | 10000 EUR | Greater than the payment amount | | Test a chargeback without an explicit reason code in a currency that differs from the test payment. | **Chargeback 10000 USD** | 10000 EUR | Different currency | | Test a chargeback with a **ChargebackReversed** status without an explicit reason code. | **Chargeback Reversed** | Any | Full | | Test a chargeback with a **ChargebackReversed** status without an explicit reason code that has the same value and currency as the test payment. | **Chargeback Reversed 10000 EUR** | 10000 EUR | Full | | Test a partial chargeback with a **ChargebackReversed** status without an explicit reason code that has a lower value but the same currency as the test payment. | **Chargeback Reversed 9000 EUR** | 10000 EUR | Partial | | Test a chargeback with a **ChargebackReversed** status without an explicit reason code that has higher value but the same currency as the test payment. | **Chargeback Reversed 11000 EUR** | 10000 EUR | Greater than the payment amount | | Test a chargeback with a **ChargebackReversed** status without an explicit reason code in a currency that differs from the test payment. | **Chargeback Reversed 10000 USD** | 10000 EUR | Different currency | | Test a chargeback with a **SecondChargeback** status without an explicit reason code. | **Second Chargeback** | Any | Full | | Test a chargeback with a **SecondChargeback** status without an explicit reason code that has the same value and currency as the test payment. | **Second Chargeback 10000 EUR** | 10000 EUR | Full | | Test a partial chargeback with a **SecondChargeback** status without an explicit reason code that has a lower value but the same currency as the test payment. | **Second Chargeback 9000 EUR** | 10000 EUR | Partial | | Test a chargeback with a **SecondChargeback** status without an explicit reason code that has higher value but the same currency as the test payment. | **Second Chargeback 11000 EUR** | 10000 EUR | Greater than the payment amount | | Test a chargeback with a **SecondChargeback** status without an explicit reason code in a currency that differs from the test payment. | **Second Chargeback 10000 USD** | 10000 EUR | Different currency | ## Make a test payment In your test environment, submit a payment request with the `holderName` set to any of the values from the [table](#test-example-values). The following example shows a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request to simulate a full chargeback with reason code 10.4. **Payment request to simulate a chargeback with reason code 10.4** ```sh curl https://checkout-test.adyen.com/v72/payments -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount": { "currency": "EUR", "value": 10000 }, "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.example.com/...", "merchantAccount": "YOUR_MERCHANT_ACCOUNT" }' ``` You receive a response containing a `pspReference`, our unique identifier for the payment. You need this `pspReference` to capture the payment in the next step. ## Capture the payment To capture the test payment, make a [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request, where `{paymentPspReference}` is the `pspReference` you received in the payment response. In the `amount` object, specify the `value` and `currency` that you used in the test payment request. **Capture request** ```sh curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/captures \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "amount": { "currency": "EUR", "value": 10000 }, "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. ## Monitor webhooks After you capture the test payment, you receive a [CAPTURE](https://docs.adyen.com/api-explorer/Webhooks/latest/post/CAPTURE) webhook message. The test payment then goes through **SentforSettle**, **Settled**, and finally the **Chargeback** status. This process can take up to 24 hours to complete. Listen for the webhook message related to the chargeback scenario that you are testing. For example, if you are testing a chargeback flow, you will receive a [NOTIFICATION\_OF\_CHARGEBACK](/risk-management/disputes-api/dispute-notifications#notification_of_chargeback). This webhook message contains a `pspReference`, which is the unique identifier for the dispute. For example: **NOTIFICATION\_OF\_CHARGEBACK webhook** ```json { "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":10000 }, "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" } } ] } ``` ## Accept or defend the dispute If you are simulating a chargeback, you can use the [Disputes API](/risk-management/disputes-api) to accept or defend the simulated chargeback, or use your [Customer Area](/risk-management/manage-disputes). To defend the dispute using the Disputes API: 1. [Retrieve defense reasons](/risk-management/disputes-api#retrieve-dispute-information) 2. [Upload dispute defense documents](/risk-management/disputes-api#supply-dispute-defense-documents) 3. [Defend the dispute](/risk-management/disputes-api#defend-dispute) Or, you can [accept the dispute](/risk-management/disputes-api/#accept-dispute) using the Disputes API. To accept or defend the dispute using the Customer Area: 1. Go to **Revenue & risk** > **Disputes** 2. Select the simulated dispute and either accept or defend the dispute. ## See also * [Understanding and defending disputes](/risk-management/understanding-disputes/) * [Dispute reason codes and defense requirements](/risk-management/understanding-disputes/dispute-reason-codes/) * [Manage disputes](/risk-management/manage-disputes/) * [Dispute webhooks](/risk-management/disputes-api/dispute-notifications/) * [Disputes API](/risk-management/disputes-api/)