# Testing

## 1. Staging Environment Setup

1. Use staging API endpoints
   - https://api.teya.xyz
2. Obtain test merchant credentials
3. Use test card numbers
4. Set `developmentMode: true` when calling `initTeyaBlocks()` - see [SDK Initialization](/partners/online-payments/embedded-components/sdk-initialization). Without this flag the SDK calls production APIs and your staging session token will be rejected.

## 2. Test Cards

For all test cards below, use any future expiry date and any 3-digit CVC for Visa/Mastercard (4 digits for Amex). Diners Club and Discover cards use the exact CVC and expiry listed with their cards below.

### Frictionless (No 3DS Challenge)

These cards complete 3DS authentication automatically without prompting the cardholder for a challenge.

| Scheme | Card Number |
|---|---|
| Visa | `4427 8000 0018 0034`, `4176 6622 3003 1038` |
| Mastercard | `5413 3300 0200 1015`, `5239 2907 0000 0101` |
| Amex | `3759 870001 69545` |

### Challenge - Success

These cards trigger a 3DS challenge that the tester can complete successfully.

**Secret Code Challenge** - The 3DS simulator presents a form where you enter a secret code to authenticate.

| Scheme | Card Number |
|---|---|
| Visa | `4274 8998 1331 1525`, `4147 4630 1111 0182` |
| Mastercard | `5413 3300 0200 1031`, `5239 2907 0000 0150` |
| Amex | `3767 010782 52003` |

**Predefined Response Challenge** - The 3DS simulator presents buttons. Select **Y** to authenticate successfully.

| Scheme | Card Number |
|---|---|
| Visa | `4147 4630 1111 0190` |
| Mastercard | `5413 3300 0200 1056`, `5239 2907 0000 0168` |
| Amex | `3759 870001 69578` |

**Authentication Code Challenge (Diners Club & Discover)** - The 3DS page presents a 6-digit code input that submits automatically. Enter `111111` to authenticate successfully. Use the exact CVC and expiry shown for each card.

| Scheme | Card Number | CVC | Expiry |
|---|---|---|---|
| Diners Club | `3625 9600 5001 02` | `123` | `12/31` |
| Discover | `6549 9801 0000 0601` | `600` | `07/28` |

### Challenge - Failed

Use the same **Predefined Response Challenge** cards above and select **N** (Not Authenticated) to simulate a failed 3DS challenge. For Diners Club and Discover, use the **Authentication Code Challenge** cards above and enter any code other than `111111`.

| Scheme | Card Number |
|---|---|
| Visa | `4147 4630 1111 0190` |
| Mastercard | `5413 3300 0200 1056` |
| Amex | `3759 870001 69578` |

### Frictionless - Declined (Challenge Required)

These cards return a frictionless "NO" response, meaning the issuer requires a challenge but the card is not enrolled for one, resulting in a declined transaction.

| Scheme | Card Number |
|---|---|
| Visa | `4000 0000 0000 0002`, `4147 4630 1111 0141` |
| Mastercard | `5204 7300 4000 2326`, `5239 2907 0000 0119` |
| Amex | `3714 496353 98431` |

### Predefined Authentication Responses

When using **Predefined Response Challenge** cards, the 3DS simulator presents the following options:

| Response | Meaning | Result |
|---|---|---|
| **Y** | Authenticated | Payment succeeds - cardholder fully authenticated |
| **N** | Not Authenticated | Payment fails - authentication was explicitly rejected |
| **A** | Attempted | Payment succeeds - authentication was attempted but could not be completed (e.g. issuer not participating) |
| **U** | Unable to Authenticate | Payment fails - authentication could not be performed due to a technical issue |
| **R** | Rejected | Payment fails - issuer rejected the authentication request |

## 3. Integration Testing Checklist

- [ ] Credential and webhook creation
- [ ] Complete payment flow
- [ ] Cancelled payment handling
- [ ] Payment success webhook handling with signature verification
- [ ] Token expiration and refresh
- [ ] Error scenarios with proper handling
- [ ] Currency conversion
- [ ] Full refund processing
- [ ] Partial refund processing
- [ ] Multiple partial refunds
- [ ] Refund validation (exceeded amount)
- [ ] Refund error handling
