To try a SePay integration without real money, use the SePay CLI sandbox. The sandbox commands create test bank accounts and simulated transactions there. Your company needs Test mode turned on; a SuperAdmin, an Admin or a user with the Developer permission can turn it on (see Test mode).
sandbox init
Creates a sandbox bank account, optionally with a VA, a webhook and sample transactions.
Parameters
| Flag | Type | Required | Description |
|---|---|---|---|
--bank | string | No | Bank code for the test account. Default ACB when the sandbox offers it, else the first bank the sandbox offers |
--with-va | bool | No | Also create a virtual account (VA). Some banks such as OCB, KLB, MSB and VCB already get a first VA when the account is created, so this flag leaves two VAs |
--with-webhook | string | No | Also create a webhook that delivers to this URL |
--with-webhook-listen | bool | No | Also create a webhook with no URL, received through webhook listen |
--seed | int | No | Number of sample transactions to create, up to 100 |
Example
$ sepay sandbox init --with-webhook-listen --yesenv: sandboxCreated bank account 832529c1-xxxx-xxxx-xxxx-fa163e2f7c98 (ACB).Created listen-only webhook 5f0e2a7b-xxxx-xxxx-xxxx-fa163e2f7c98.832529c1-xxxx-xxxx-xxxx-fa163e2f7c98Notes
- The last line is the account xid. An xid is the ID SePay gives each account, webhook and transaction; other commands take it to point at the right one. To see the account xid again, run
sepay bank-account list(theIDcolumn). --yestakes the defaults for every flag you leave out: the--bankdefault, no VA, no webhook, no sample transactions.- Each run creates a new account and a new webhook.
- If a step is refused part-way, the CLI prints
! stopped part-way; what it created above already exists: what it created stays. Runsepay sandbox resetto clear everything, then run it again.
sandbox simulate
Creates a simulated transaction. SePay treats it like a real one and sends notifications to the webhooks that apply to the account.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
<event> or --event | string | Yes | payment_in (money in), payment_out (money out), va_credit (money in to a VA) |
--bank-account | string | Yes | Sandbox bank account xid |
--amount | int | Yes | Amount in VND, from 1,000 to 499,000,000 |
--code | string | No | Payment code, up to 10 characters (plain ASCII is recommended) |
--va | string | With va_credit | The VA number (not the xid) |
--override | string[] | No | Override a payload field as key=val; only content is supported |
Example
Create an incoming payment to a bank account, with a payment code:
$ sepay sandbox simulate payment_in --bank-account <bank-account-xid> --amount 50000 --code DH1709Create an incoming payment to a VA:
$ sepay sandbox simulate va_credit --bank-account <bank-account-xid> --va <VA number> --amount 50000--code pre-fills the payment code in the webhook (how this differs from detecting the code in the transfer content).
Output
env: sandboxSimulated payment_in event.a41c9e02-xxxx-xxxx-xxxx-fa163e2f7c98Notes
- The last line is the transaction xid, which you can pass to
sepay transaction get.
sandbox seed
Creates sample transactions on a sandbox account.
| Flag | Type | Required | Description |
|---|---|---|---|
--bank-account | string | Yes | Account xid |
--count | int | No | Number of transactions, from 1 to 100. Default 5 |
$ sepay sandbox seed --bank-account <bank-account-xid> --count 5sandbox reset
Deletes every sandbox webhook and bank account of your company, with their VAs and transactions.
$ sepay sandbox resetThe command always asks for confirmation; without a terminal you need --yes.
Sandbox bank accounts
Create or delete more sandbox bank accounts with bank-account create and bank-account delete, see Bank accounts.