Direct API

Virtual Account

Virtual Account is a unique account number generated electronically by banks or payment service providers, such as Espay Payment Gateway. This Virtual Account is designed to facilitate payment transactions more easily and more organized.

Before Integration

Make sure you have received the credentials from the Espay team.

Integration Steps

You can use the following steps to integrate with Direct API – Virtual Account.

1. Display Payment Method

Inquiry Merchant Info is a service that helps find active bank and product codes. This service allows you to customize the user interface (UI) when selecting a payment method. Learn Inquiry Merchant Info

2. Create Inquiry and Payment Services

You are required to provide a callback that the Espay Payment Gateway can access. Learn more about Inquiry (only Dynamic Virtual Account) and Payment.

3. Create Virtual Account

Flow

You send the required parameters to make a request, and Espay Payment Gateway will respond in JSON format.

API URL

Environment URL
Sandbox
https://sandbox-api.espay.id/rest/merchantpg/sendinvoice
Production
https://api.espay.id/rest/merchantpg/sendinvoice

Headers

Key Value
Method
HTTP Post
Connection
keep-alive
Content-Length
250
Content-Type
application/x-www-form-urlencoded
Accept
*/*

Request Parameters

Parameter Type Mandatory Description
rq_uuid
String (64)
Y
Request identifier. A unique ID used to identify messages.
rq_datetime
String (19)
Y
Date and time of the transaction request from the merchant's server.

Format:
yyyy-MM-dd hh:mi:ss

Example:
2024-03-14 07:49:28
order_id
String (32)
Y
Unique code to identify the order/billing/invoice.

Example:
Transaction number, invoice ID, etc.
amount
String (17)
Y
Paid amount.

Format:
Desimal .00

Example:
150000.00
ccy
String (3)
Y
Transaction currency code.

Format:
  • Rupiah: IDR
comm_code
String (32)
Y
Merchant code from Espay team.

Example:
SGWYESSISHOP
remark1
String (17)
C
The first description is mandatory and can be 'Yes' following the scheme. It is filled with the Mobile Number.
remark2
String (30)
Y
The second description can be filled in with a name.
remark3
String (50)
O
The third description can be filled in with an email address.
remark4
String (32)
C
The fourth description contains the merchant's Unique ID, which Espay uses for validation, specifically for Fixed Virtual Accounts (static virtual accounts).
update
String (1)
Y
Transaction condition.

Format:
  • Update transaction based on order_id: Y
  • Create a transaction with a new order_id: N
bank_code
String (3)
Y
bank code. Click here
va_expired
String (20)
O
Transaction expiration time in minutes.

Example:
60 minute: 60
signature
String (64)
Y
Code used to validate transactions. Learn Signature.
Y: Yes, O: Optional, C: Conditional

Response Parameters

Parameter Type Mandatory Description
rq_uuid
String (64)
Y
Request identifier. A unique ID used to identify messages.
rs_datetime
String (32)
Y
Date and time of the transaction response from the Espay server.
error_code
String (4)
Y
Response Code.
error_message
String(32)
Y
Response description.
va_number
String (16)
Y
The virtual account number used for payment.
expired
String (19)
Y
Transaction expiration time in minutes.

Example:
60 minutes: 60
description
String (32)
Y
Transaction description.
total_amount
String (17)
Y
Paid amount after transaction fee.

Format:
amount + fee. Desimal.00 (ISO 4217)

Example:
155000.00
amount
String (17)
Y
Paid amount after transaction fee.

Format:
amount + fee. Desimal.00 (ISO 4217)

Example:
150000.00
fee
String (17)
Y
Transaction fee.

Format:
Desimal .00 (ISO 4217)

Example:
5000.00
Y: Yes, O: Optional, C: Conditional
4. After Payment
Espay Payment Gateway provides an optional API that you can use to support other payment needs.

Try It!

You can enter data using the input provided. After that, you submit and see the results!

Request

Value

Response





















































































































Sample Request

POST /rest/merchantpg/sendinvoice HTTP/1.1
Host: sandbox-api.espay.id
Connection: keep-alive
Content-Length: 250
Content-Type: application/x-www-form-urlencoded
Accept: */*

rq_uuid:abcbd39734-ed32-490d-98c4-e91bcd91037b
rq_datetime:2024-04-30 17:48:24
order_id:ORDER004
amount:890000
ccy:IDR
comm_code:SGWDIGALLERY
remark1:082138802290
remark2:TravelAja OTA Web Tiara Iyay
remark3:test@gmail.com
remark4:..........
update:N
bank_code:014
va_expired:30
signature:d4787b96b6ee30036e42cf54bbf346559a8200feb0ce81a1df74231759990e31

             






































Sample Positive Response

{
  "rq_uuid": "fbd39734-ed32-490d-98c4-e91bcd91037a",
  "rs_datetime": "2024-03-15 10:06:16",
  "error_code": "0000",
  "error_message": "",
  "va_number": "8920800679171597",
  "expired": "2024-03-15 10:16:16",
  "description": "Invoice No 123456",
  "total_amount": "10001.00",
  "amount": "10001.00",
  "fee": "0.00",
  "bank_code": "008"
}
              


Sample Negative Response

    
{
  "rq_uuid": "abcbd39734-ed32-490d-98c4-e91bcd91037b",
  "rs_datetime": "2024-06-04 20:19:01",
  "error_code": "0031",
  "error_message": "Rejected, Error komunikasi dengan Mitra"
}

              









cURL


curl --location 'https://sandbox-api.espay.id/rest/merchantpg/sendinvoice' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'rq_uuid=abcbd39734-ed32-490d-98c4-e91bcd91037b' \
--data-urlencode 'rq_datetime=2024-04-30 17:48:24' \
--data-urlencode 'order_id=ORDER004' \
--data-urlencode 'amount=890000' \
--data-urlencode 'ccy=IDR' \
--data-urlencode 'comm_code=SGWDIGALLERY' \
--data-urlencode 'remark1=082138802290' \
--data-urlencode 'remark2=TravelAja OTA Web Tiara Iyay' \
--data-urlencode 'remark3=test@gmail.com' \
--data-urlencode 'remark4=' \
--data-urlencode 'update=N' \
--data-urlencode 'bank_code=014' \
--data-urlencode 'va_expired=30' \
--data-urlencode 'signature=d4787b96b6ee30036e42cf54bbf346559a8200feb0ce81a1df74231759990e31'


           








































Scroll to Top