# Testing redirect payment methods

The following are the payment methods with a `redirect` [authentication flow](/commerce-api/payments/sources.md#authentication-flow) that Digital River currently supports in our testing environment: Afterpay, Alipay (domestic), Alipay+ (cross-border), Amazon Pay, Bancontact, BLIK, Boleto, CCAvenue, Clearpay, iDEAL, Klarna, Online Banking (FPX), Online Banking (IBP), Online Banking (Korea Bank Transfer), PayCo, PayPal, PayPal Billing, PayPal Credit, PayPal Py in 3, PayPal Pay in 4, PayPal RatenZahlung, SEPA Direct Debit, and TreviPay.

## Success scenarios

Use the [create source method](/commerce-api/shopper-apis/cart/payment-sessions.md#creating-a-source-with-payment-sessions) to provide success scenario test data for the redirect payment sources. Once you've done this, you should receive a Source in a `pending_redirect` state.

You'll then be directed to our generic authorization page that contains accept and reject options. Follow the redirect and select one of the following options:

| Option  | Expected result                                   |
| ------- | ------------------------------------------------- |
| Approve | The Source moves to a `chargeable` state          |
| Decline | The Source remains in a `pending_redirect` state. |

## Error scenarios

First, select one of the following payment methods for redirect sources. Then, identify the error scenario you would like to test against. Finally, when [creating a source](/commerce-api/payments/sources/using-the-source-identifier.md#creating-payment-sources), the `lastName` parameter in the [Owner object](/commerce-api/payments/payments-solutions/digitalriver.js/payment-methods/common-payment-objects.md#owner-object) to the value you expect to trigger the scenario.

{% tabs %}
{% tab title="PayPal" %}
This tab's testing information applies to PayPal, PayPal Billing Agreement, and PayPal Credit.

| Scenario             | Description                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------------- |
| `lastName` parameter | Expected result                                                                                                 |
| SourceCreationFail   | `Source` creation fails. The `Source` state is `failed` .                                                       |
| ChargeCreationFail   | `Source` creation is successful but `Charge` creation fails. The `Charge` state is `failed` .                   |
| RefundFail           | `Source` and `Charge` creation is successful. Any refunds against the charge fail. `Refund` state is `failed` . |
| {% endtab %}         |                                                                                                                 |

{% tab title="SEPA Direct Debit" %}

### Error Scenarios&#x20;

After being triggered, SEPA Direct Debit error scenarios provide the following unique data to the `Source` owner:

| Scenario                 | Description                                                                                                              |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| SourceFail               | `Source` creation fails. The `Source` state is `failed` .                                                                |
| SourceFailAfterRedirect  | `Source` moves to `failed` state after redirecting from payment page.                                                    |
| ChargeFail               | `Source` creation is successful but `Charge` creation fails. The `Charge` state is `failed` .                            |
| ChargeFailedAfterPending | The `Charge` is initially created in a `pending` state. After a webhook call, the `Charge` is moved to a `failed` state. |
| RefundFail               | `Source` and `Charge` creation is successful. Any refunds against the charge fail and the `Refund` state is `failed` .   |
| RefundFailedAfterPending | The `Refund` is initially created in a `pending` state. After a webhook call, the `Refund` is moved to a `failed` state. |
| ChargeRemainPending      | The `Charge` remains in a `pending` state after creation.                                                                |
| {% endtab %}             |                                                                                                                          |

{% tab title="Klarna Credit" %}

| Scenario             | Description                                                                                       |
| -------------------- | ------------------------------------------------------------------------------------------------- |
| `lastName` parameter | Expected result                                                                                   |
| Expected result      | A Source is not created. The `state` of the Source is `failed`.                                   |
| ChargeCreationFail   | A Source is successfully created, but the Charge fails. The `state` of the Charge is `failed`.    |
| RefundFail           | successfully created, but refunds against the Charge fail. The `state` of the Refund is `failed`. |
| {% endtab %}         |                                                                                                   |

{% tab title="Alipay" %}

### Error Scenarios&#x20;

After being triggered, Alipay error scenarios provide the following unique data to the `Source` owner:

| Scenario              | Description                                                                                                                        |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `lastName` parameter  | Expected result                                                                                                                    |
| authFail              | A Source is not created. The `state` of the Source is `failed`.                                                                    |
| authFailAfterRedirect | A Source is successfully created but the Charge fails. The `state` of the Charge is `failed`.                                      |
| refundFail            | Both a Source and the Charge are successfully created, but refunds against the Charge fail. The `state` of the Refund is `failed`. |
| {% endtab %}          |                                                                                                                                    |
| {% endtabs %}         |                                                                                                                                    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/payments/testing-scenarios/testing-redirect-payment-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
