Mock Transaction API
API for creating mock transactions in the sandbox environment to test transaction flows and webhooks.
API Endpoint
POST
https://bankhub-api-sandbox.sepay.vn/v1/transaction/createRequest Body
bank_account_xidstringrequired
Bank account ID
transfer_typeenumrequired
Transaction type (credit = incoming, debit = outgoing)
amountnumberrequired
Transaction amount (VND)
transaction_contentstringrequired
Transaction content
Note
- For sandbox environment only
- Mock transactions are used to test webhooks and transaction processing flows
- The
transfer_typefield distinguishes incoming (in) and outgoing (out) transactions
Error Handling
400Validation ErrorInvalid input data
401UnauthorizedThe access token is invalid or has expired
403ForbiddenThis API is only available in the Sandbox environment
API Response
Response 200 - Created Successfully
{
"code": 201,
"message": "string",
"data": {
"transaction_id": "string",
"reference_number": "string",
"transaction_date": "string",
"amount": 0,
"transfer_type": "string",
"accumulated": 0
}
}codeinteger
HTTP status code
messagestring
Result message
dataobject
Mock transaction data
Code Examples
>
>
>
>
>
curl --request POST \--url https://bankhub-api-sandbox.sepay.vn/v1/transaction/create \--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \--header 'content-type: application/json' \--data '{"bank_account_xid":"52930e2b-c38b-4cd1-b2a2-9ddcdc603104","transfer_type":"credit","amount":0,"transaction_content":"string"}'
Usage Examples
JSCreate an inbound transaction
1
2
3
4
5
6
7
8
9
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/transaction/create' \--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \--header 'Content-Type: application/json' \--data '{"bank_account_xid": "ba_abc123xyz","transfer_type": "in","amount": 500000,"transaction_content": "Payment for order DH123456"}'
JSCreate an outbound transaction
1
2
3
4
5
6
7
8
9
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/transaction/create' \--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \--header 'Content-Type: application/json' \--data '{"bank_account_xid": "ba_abc123xyz","transfer_type": "out","amount": 100000,"transaction_content": "Transfer"}'
Webhook
- After creating a mock transaction, the transaction webhook will be sent to your endpoint if configured
- See the webhook configuration guide here
Sandbox Only
This API is only available in the Sandbox environment. Calling it in Production will result in a 403 Forbidden error.