# Sandbox

> Use sandbox to simulate payments and ensure seamless integration of their applications with Antom products.

The sandbox provides you a testing environment to simulate payments and ensure seamless integration of their applications with Antom products. This topic will guide you through the process of using the sandbox effectively.

## Before you begin

Complete the following steps before testing in the sandbox:

1.  Log in to [Antom Dashboard](https://dashboard.alipay.com/global-payments/home), switch to Test mode, go to **Developer** > **Quick start** > **Integration resources and tools**, and select **Integration resources** to get the sandbox client ID, domain, and public key.
2.  Download the test wallet app. Refer to the [Test wallet](https://docs.antom.com/ac/ref/testwallet.md) for guidance.

## Test in sandbox

In the sandbox, multiple ways are provided to make an API call simulation, and you can call each API multiple times. API calls are correlated with each other if you provide the corresponding information. For example, you first call the **pay** API to initiate a payment. Then you can call the **refund** API to initiate a refund against the payment by specifying _paymentId_. Information about both the payment and related refund is provided in the sandbox environment.

In addition, when you call the **pay** or **consult** API in the sandbox, the sandbox also simulates the redirection process between the merchant side and the payment method side for different terminal types such as WEB, WAP, and APP.

### For One-time Payments/Tokenized Payment

To test One-time Payments and Tokenized Payment, you can use the provided testing guides to simulate the payment and vaulting process across various payment methods. The sandbox can also simulate all error codes, even rare production environment scenarios via the tool [Error scenario simulation](https://docs.antom.com/ac/merchant_service/error_scenario_sim.md). This enables developers to work with consistent system logic processing during testing.

#### Test for payment methods

| **Payment method** | **Testing guide** |
| --- | --- |
| Card | [How to test card payments](https://docs.antom.com/ac/ref/card.md) |
| Digital wallet | [How to test the Alipay+ payment methods](https://docs.antom.com/ac/ref/wallet.md) |
| Online banking | [How to test other payment methods](https://docs.antom.com/ac/ref/other.md) |
| Cash payment | [How to test other payment methods](https://docs.antom.com/ac/ref/other.md) |
| Mobile banking app | [How to test other payment methods](https://docs.antom.com/ac/ref/other.md) |

#### Simulate error scenarios

Error scenario simulation provides simulations of different API results and returns the specified response for integration testing. Refer to [Error scenario simulation](https://docs.antom.com/ac/merchant_service/error_scenario_sim.md) for detailed information.

### For Subscription Payment

In the sandbox, you can create, update, and cancel a subscription plan. The sandbox automatically speeds up the subscription deduction cycle to facilitate your verification process. The table below illustrates how it works.

| **periodRule.periodType** | **periodRule.periodCount** | **Sandbox acceleration interval (min)** | **Acceleration frequency** |
| --- | --- | --- | --- |
| `DAY` | `31` | 3 | 12 |
| `DAY` | `93` | 3 | 12 |
| `DAY` | `366` | 3 | 12 |
| `WEEK` | `1` | 3 | 12 |
| `MONTH` | `1` | 3 | 12 |
| `MONTH` | `3` | 15 | 12 |
| `MONTH` | `6` | 30 | 12 |
| `YEAR` | `1` | 60 | 12 |

For example, create a subscription plan with a subscription period of 31 days.

```json
{
  "subscriptionRequestId": "REQUEST_20240409141836419",
  "subscriptionDescription": "Subscription test",
  "paymentMethodType": "GCASH",
  "env": {
    "osType": "ANDROID",
    "terminalType": "APP"
  },
  "orderInfo": {
    "orderAmount": {
      "currency": "PHP",
      "value": "100"
    }
  },
  "paymentAmount": {
    "currency": "PHP",
    "value": "100"
  },
  "periodRule": {
    "periodCount": 31,
    "periodType": "DAY"
  },
  "settlementStrategy": {
    "settlementCurrency": "USD"
  },
  "subscriptionStartTime": "2024-04-09T14:18:36+08:00",
  "subscriptionEndTime": "2074-04-09T14:18:36+08:00",
  "subscriptionExpiryTime": "2024-04-09T14:48:36+08:00",
  "subscriptionNotificationUrl": "https://www.baidu.com",
  "subscriptionRedirectUrl": "https://alipay.com/subscriptionNotify",
  "paymentNotificationUrl": "https://alipay.com/subscriptionPayNotify"
}
```

Follow the instructions of [How to test Alipay+ payment methods](https://docs.antom.com/ac/ref/wallet.md) to complete the vaulting process in the sandbox, then you will start receiving deduction notifications every 3 minutes. The deduction cycle stops accelerating after the thirteenth deduction. The final deduction notification during the acceleration cycle is detailed below:

```json
{
    "paymentAmount": {
        "currency": "PHP",
        "value": "100"
    },
    "paymentCreateTime": "2024-04-08T23:59:00-07:00",
    "paymentId": "202404091940108001001886J0299059200",
    "paymentTime": "2024-04-08T23:59:03-07:00",
    "periodEndTime": "2025-05-16T23:18:36-07:00",
    "periodStartTime": "2025-04-15T23:18:36-07:00",
    "phaseNo": "13",
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success",
        "resultStatus": "S"
    },
    "subscriptionId": "202404091900000000000009D0000004046",
    "subscriptionRequestId": "REQUEST_20240409141836419",
    "subscriptionNo": "13"
}
```