Skip to main content

Pay a bill

Use this API to create a bill payment request.

  • If the customer requires confirmation before automatic payment, Tingee sends an Email/Zalo notification to the customer.
  • If the customer does not require payment confirmation, the bill is debited automatically from the customer's account.
POST
URLhttps://open-api.tingee.vn/v1/direct-debit/payment-bill

Request a bill payment from a linked customer account. Supports automatic payment or payment with confirmation.

Header Request​

HeaderRequiredDescription
Content-Type✓application/json
x-client-id✓Partner identifier issued by TINGEE.
x-signature✓HMAC SHA512 authentication signature. See How to generate the signature.
x-request-timestamp✓Time the request is sent (format: yyyyMMddHHmmssSSS, UTC+7)

Body Parameter​

FieldTypeRequiredDescription
requestIdstring✓ID of the request to Tingee (UUID), unique for each payment.
This value is used as the transactionId of the debit transaction on TINGEE.
subscriptionIdstring✓ID of the linked bank account (UUID). The account must be active.
tokenRefstring✓Reference code of the customer's account.
amountstring✓Bill amount to pay (VND), sent as a numeric string. Example: "500000".
descriptionstring✓Payment description.
partnerCodestring✓Debit partner. Valid value: one-pay.
serviceProviderNamestring✓Name of the partner using the service (shown in the confirmation notification sent to the customer).
returnUrlstring✓URL to redirect back to the partner after completion.
accountNumberstring✕Customer's account number.
The system always debits the account linked to subscriptionId.
additionalDataobject✕Additional data (bill number, customer name, ...).
The object's JSON string is at most 500 characters. The billNumber field (if any) is shown as the bill number in the Email/Zalo confirmation.

Code samples​

curl --location --request POST 'https://open-api.tingee.vn/v1/direct-debit/payment-bill' \
--header 'accept: application/json' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'x-request-timestamp: 20240509154004003' \
--header 'x-signature: YOUR_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"requestId": "550760e0-1cc2-44b9-85ba-eb318e228b4f",
"subscriptionId": "89188e53-eba3-40fa-9323-04422ced3637",
"tokenRef": "TKN-123456789",
"amount": "500000",
"description": "THANH TOAN HOA DON DV HD123456",
"partnerCode": "one-pay",
"serviceProviderName": "Công ty TMCP ABC",
"returnUrl": "https://example.com"
}'

Sample Response​

Automatic payment (the customer does not require confirmation):

{
"code": "00",
"message": "Success",
"data": {
"code": "00",
"status": "success",
"transactionCode": "TXN-0123456789",
"returnUrl": "https://example.com?message=Success&type=direct-debit-transaction"
}
}

Customer confirmation required (Email/Zalo confirmation is enabled):

{
"code": "00",
"message": "Success",
"data": {
"code": "00",
"isSentConfirmEmail": true,
"isSentConfirmZalo": false
}
}
FieldTypeDescription
codestringResponse code (00 means success).
messagestringDetailed message.
data.codestringResult of the payment request:
- 00: Successful (or the confirmation request was sent to the customer).
- 01: Failed.
- 02: Processing.
- 03: Unknown.
data.statusstringTransaction status (automatic payment only): success, failure, pending, insufficient-balance (insufficient balance), exceed-daily-limit (limit exceeded).
data.transactionCodestringTransaction code at the debit gateway (automatic payment only).
data.returnUrlstringreturnUrl with the result parameter message (Success/Failed) and type=direct-debit-transaction appended (automatic payment only).
data.isSentConfirmEmailbooleantrue if a payment confirmation Email was sent to the customer (confirmation required only).
data.isSentConfirmZalobooleantrue if a payment confirmation Zalo notification was sent to the customer (confirmation required only).

The final result of the transaction is sent via Webhook, or you can look it up with the Query transaction status API.


Common error codes​

CodeDescriptionHow to handle
1067No active automatic payment subscription was foundCheck that the subscription's subscriptionId and tokenRef are still valid; if the customer has cancelled, ask them to register again via Register.
1124requestId has already been used for a previous transactionGenerate a new requestId (UUID) for each debit; look up the earlier transaction instead of resending it.
1121Missing returnUrlSend a valid returnUrl so TINGEE can redirect the customer after payment.
1120Missing tokenRefSend the tokenRef you received when registration succeeded.
1068, 1009Direct Debit is not configured for the Merchant, or the payment platform is not supportedContact TINGEE to check the Merchant's Direct Debit configuration.
90, 91, 92, 97Request authentication error (timestamp, client-id, signature)See System error codes.
OthersOther errorsSee Error codes.