> For the complete documentation index, see [llms.txt](https://docs.payr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payr.com/testing.md).

# Testing

Use the following test cards and payment methods to test your Payr integration in the **Sandbox environment**.

***

### Environment Configuration for Testing

Before testing, ensure you're using the sandbox environment URLs.

#### For Iframe Integration

Use the sandbox iframe URL when creating your iframe:

```html
<iframe
  src="https://sandbox.mypayr.co.uk/third-party?token={token}&session_id={session_id}"
  width="100%"
  height="700"
  frameborder="0"
  allow="payment"
></iframe>
```

**Important:** Make sure to call the sandbox API (`https://sandbox-api.mypayr.co.uk/thirdparty/user-login/`) to get the token and session\_id.

***

#### For SDK Integration

Configure the SDK to use the sandbox environment:

```javascript
PAYR.init({
  apiBaseUrl: 'https://sandbox-api.mypayr.co.uk',
  authToken: tokenFromYourBackend,
  container: '#payr-payment-form',
  environment: 'sandbox',  // Use sandbox for testing
  debug: true              // Optional: Enable verbose logging
});
```

For complete environment configuration details, see **Environments**.

***

### Test Cards

#### Successful Authentication (Frictionless)

These cards complete 3DS authentication without requiring a challenge.

**Outcome:** `authenticated`

| Card Network        | Card Number        | Description                 |
| ------------------- | ------------------ | --------------------------- |
| **Visa**            | `4000000000002701` | Frictionless authentication |
| **Mastercard**      | `5200000000002235` | Frictionless authentication |
| **AMEX**            | `340000000002708`  | Frictionless authentication |
| **Discover/Diners** | `6011000000002117` | Frictionless authentication |
| **JCB**             | `3338000000000296` | Frictionless authentication |
| **CB (Visa)**       | `4000000000004970` | Frictionless authentication |
| **CB (Mastercard)** | `5200000000004801` | Frictionless authentication |

***

#### Successful Authentication (Challenged)

These cards trigger a 3DS challenge during authentication. The customer will be prompted to complete the challenge successfully.

**Outcome:** `authenticated` (after successful challenge)

| Card Network        | Card Number        | Description        |
| ------------------- | ------------------ | ------------------ |
| **Visa**            | `4000000000002503` | Challenge required |
| **Mastercard**      | `5200000000002151` | Challenge required |
| **AMEX**            | `340000000002534`  | Challenge required |
| **Discover/Diners** | `6011000000002265` | Challenge required |
| **JCB**             | `3338000000000569` | Challenge required |
| **CB (Visa)**       | `4000000000004855` | Challenge required |
| **CB (Mastercard)** | `5200000000004074` | Challenge required |

***

### Additional Card Details

When testing with the cards above, you can use the following details:

* **CVV:** Any 3 digits (e.g., `123`), or 4 digits for AMEX cards (e.g., `1234`)
* **Expiry Date:** Any future date (e.g., `12/25`)
* **Cardholder Name:** Any name

***

### Alternative Payment Methods

#### Alipay & UnionPay

For **Alipay** and **UnionPay** testing:

1. Proceed with the payment flow as normal
2. You will be redirected to a test authorization screen
3. **Mark the payment as "Authorized"** on the redirect screen
4. This will simulate a successful transaction

***

#### WeChat Pay

For **WeChat Pay** testing:

1. Proceed with the payment flow as normal
2. Wait for **15 seconds**
3. The payment status will automatically change to **"Authorized"**
4. This simulates a successful WeChat Pay transaction

> **Note:** No manual action is required for WeChat Pay - the authorization happens automatically after 15 seconds.

***

### Wallet Payments

#### Apple Pay

**Sandbox Environment:**

* Use Safari on macOS or iOS device
* Set up a Sandbox Apple ID in Settings
* Add test cards to Wallet
* Test on `https://localhost` or your staging domain (after domain verification)

**Production Environment:**

* Use real Apple ID with real cards
* Test on your production domain (after domain verification)

For Apple Pay setup and domain verification, see **Wallet Payments**.

***

#### Google Pay

**Sandbox Environment:**

* SDK automatically uses Google Pay TEST environment when `environment: 'sandbox'` is set
* Use test card numbers in Google Pay
* Available on Chrome desktop and Android

**Production Environment:**

* SDK automatically uses Google Pay PRODUCTION environment when `environment: 'production'` is set
* Real cards required

For Google Pay setup, see **Wallet Payments**.

***

### Webhooks in Sandbox

When testing in the Sandbox environment, webhooks will be sent to your configured endpoint with the following events:

* `payment_success` - Payment was completed successfully
* `payment_failed` - Payment was declined or failed
* `payment_pending` - Payment is awaiting confirmation

Make sure your webhook endpoint is configured in the Sandbox environment to receive test notifications.

***

### Need Help?

If you encounter any issues during testing, contact **<support@mypayr.co.uk>**.
