Sandbox with SePay CLI

Use the SePay CLI sandbox to create test bank accounts, virtual accounts and simulated transactions, then check your webhook handler without real money.

||

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

FlagTypeRequiredDescription
--bankstringNoBank code for the test account. Default ACB when the sandbox offers it, else the first bank the sandbox offers
--with-vaboolNoAlso 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-webhookstringNoAlso create a webhook that delivers to this URL
--with-webhook-listenboolNoAlso create a webhook with no URL, received through webhook listen
--seedintNoNumber 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-fa163e2f7c98

Notes

  • 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 (the ID column).
  • --yes takes the defaults for every flag you leave out: the --bank default, 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. Run sepay sandbox reset to 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

ParameterTypeRequiredDescription
<event> or --eventstringYespayment_in (money in), payment_out (money out), va_credit (money in to a VA)
--bank-accountstringYesSandbox bank account xid
--amountintYesAmount in VND, from 1,000 to 499,000,000
--codestringNoPayment code, up to 10 characters (plain ASCII is recommended)
--vastringWith va_creditThe VA number (not the xid)
--overridestring[]NoOverride 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 DH1709

Create 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-fa163e2f7c98

Notes

  • The last line is the transaction xid, which you can pass to sepay transaction get.

sandbox seed

Creates sample transactions on a sandbox account.

FlagTypeRequiredDescription
--bank-accountstringYesAccount xid
--countintNoNumber of transactions, from 1 to 100. Default 5
$ sepay sandbox seed --bank-account <bank-account-xid> --count 5

sandbox reset

Deletes every sandbox webhook and bank account of your company, with their VAs and transactions.

$ sepay sandbox reset
This can't be undone

The 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.