Balance Change Notification (IPN)
When any transaction occurs on a bank account under the Merchant’s management, SePay will notify the Merchant by calling the Balance Change Notification API (IPN) endpoint previously provided by the Merchant.
The Merchant can freely choose the endpoint path structure to receive balance change notifications and inform SePay in advance for integration configuration.
IPN JSON Payload Format
{
"gateway": "string",
"transaction_date": "Y-m-d H:i:s",
"account_number": "string",
"bank_account_xid": "string",
"va": "string | null",
"payment_code": "string | null",
"content": "string",
"transfer_type": "credit | debit",
"amount": "number",
"reference_code": "string",
"accumulated": "number",
"transaction_id": "string"
}IPN JSON Description
gatewaystringExecution gateway name. For example: MBBank, OCB.
transaction_datestringTransaction received time (ISO 8601 or timestamp).
account_numberstringBank account number.
bank_account_xidstringCorresponding bank account ID in the system.
vastring | nullVirtual Account number, if any.
payment_codestring | nullPayment code, if any.
contentstringTransaction description/content.
transfer_typestringTransaction type: credit (incoming) or debit (outgoing).
amountnumberTransaction amount (non-negative number).
reference_codestring | nullFT reference code.
accumulatednumberAccount balance after the transaction (currently not supported, default value = 0).
transaction_idstringTransaction ID.
Response Requirements
- The response content type must be
application/json - The JSON fragment must have the following format:
{
"success": true
}Security Requirements
- The Merchant’s IPN URL must support SSL (HTTPS).
- By default, SePay calls the Merchant’s IPN endpoint with the
Authorizationheader in the formatApikey {API_KEY}, where{API_KEY}is the security key previously provided by SePay. The Merchant can validate theAuthorizationheader to confirm that the request originates from SePay. - Alternatively, the Merchant may filter incoming requests by IP address. SePay will provide a list of IP addresses for whitelisting.
- The Merchant may also apply both security mechanisms simultaneously.
Conditions for SePay to Send IPN Notifications
For a company (organization) under the Merchant’s management to receive IPN notifications from SePay, all of the following conditions must be met:
- The company (organization) that owns the bank account receiving notifications must be in Active status (
status: Activeandactive: 1). See details at Get Company Details API. - The
transaction_amountconfiguration of the company (organization) owning the receiving bank account must be greater than 0 or set toUnlimited. See details at Get Company Configuration API.
Retry Mechanism
SePay will retry sending transaction notifications to the Merchant’s IPN endpoint only in the event of a network error (connection failure). Retry intervals are measured in minutes and increase according to the Fibonacci sequence.
- Maximum retry attempts: 7
- Maximum retry duration: 5 hours from the first failed attempt
- SePay network connection timeout: 5 seconds
- Maximum response wait time: 8 seconds
Duplicate Transaction Prevention
To avoid duplicate transactions caused by IPN retry mechanisms during connection issues on the Merchant’s side, SePay recommends that Merchants implement deduplication logic when handling transaction balance change notifications received via IPN.