Direct API

Payment Host to Host

Espay Payment Gateway’s Payment Host to Host service is an integration model that allows you to connect without creating your payment page. This service generates a URL that will take you directly to the Espay Checkout Page.

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 – Payment Host to Host.

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. Generate Signature Asymmetric

Every request you send will be validated by the Espay Payment Gateway using the signature parameters you have created. Learn how to make a Signature Asymmetric

3. Create Inquiry and Payment Services

You are required to provide a callback that the Espay Payment Gateway can access. Learn more about Inquiry and Payment.

4. Create Payment Host to Host Service
Type Value
Service Code
54
Name
Direct Debit Payment
HTTP Method
POST

Flow

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

API URL

Environment URL
Sandbox
Port of HTTPS (443)
https://sandbox-api.espay.id/apimerchant/v1.0/debit/payment-host-to-host
Production
Port of HTTPS (443)
https://api.espay.id/apimerchant/v1.0/debit/payment-host-to-host

Headers

Name Type Mandatory Description
Content-Type
String
Y
Content of your request body.

Example:
application/json
X-TIMESTAMP
String (25)
Y
Customer's current local date and time.

Format:
yyyy-MM-ddThh:mi:ssTZD (ISO 8601)

Example:
2024-03-14T07:49:28+07:00
X-SIGNATURE
String (255)
Y
Code used to validate transactions. Learn Signatures Asymmetric
X-EXTERNAL-ID
String (32)
Y
Numeric String. Reference number that should be unique on the same day.
X-PARTNER-ID
String (50)
Y
Merchant Code from Espay team.

Example:
SGWYESSISHOP
CHANNEL-ID
String (5)
Y
Channel id.

Value:
Espay
Authorization-Customer
String (150)
C
Access Token B2B2C. Espay -> Bank
Y: Yes, O: Optional, C: Conditional

Request Parameters​

Parameter Type Mandatory Description
partnerReferenceNo
String (32)
Y
Unique code to identify the order/billing/invoice.

Example:
Transaction number, invoice ID, etc.
merchantId
String (28)
Y
Merchant code from Espay team.

Example:
SGWYESSISHOP
subMerchantId
String (128)
O
API Key from Espay team.
amount
Object
Y
  value
String (16.2)
Y
Paid amount.

Format:
Desimal .00 (ISO 4217)

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

Format:
  • Rupiah: IDR
urlParam
Object
  url
String (255)
Y
Callback URL to merchant page (Thank you page).
  type
String (32)
Y
URL Type.

Value:
PAY_RETURN
  isDeeplink
String (1)
Y
The only supported value for SNAP is N (No).

Format:
  • Yes: Y
  • No: N
validUpTo
String (25)
O
Time and expiration date of the transaction.

Format:
yyyy-MM-ddThh:mi:ssTZD (ISO 8601)

Example:
2024-03-14T07:49:28+07:00
pointOfInitiation
String (20)
O
Information about the source of the merchant request.

Example:
Web, Mobile, POS, etc.
payOptionDetails
Object
  payMethod
String (64)
Y
Bank code. Click here.
  payOption
String (64)
Y
Product code. Click here.
  transAmount
Object
    value
String (16.2)
Y
Paid amount.

Format:
Desimal .00 (ISO 4217)

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

Format:
  • Rupiah: IDR
  feeAmount
Object
    value
String (16.2)
Y
Transaction fee.

Format:
Desimal .00 (ISO 4217)

Example:
4400.00
    currency
String (3)
Y
Transaction currency code.

Format:
  • Rupiah: IDR
additionalInfo
Object
  payType
String (20)
Y
Payment type.

Format:
  • Redirect: REDIRECT
  • Paylink: PAYLINK
  • S2BPay: S2BPAY
  userId
String (20)
O
User ID.
  userName
String (64)
O
Customer name.
  userEmail
String (64)
O
Customer email.
  userPhone
String (16)
O
Customer phone number.
  buyerId
String (8)
O
Unique merchant ID for Static Virtual Account. Used by Espay for transaction validation.
  productCode
String (16)
Y
Product code.

Format:
  • GOPAYLINK
  • OVOLINK
  • DANALINK
  balanceType
String (70)
C
Types of balance in the account.

Format:
  • CASH
  • POINT
  • GOPAY_WALLET
  • PAY_LATER
  bankCardToken
String (64)
C
accountToken from service Account Binding.
Y: Yes, O: Optional, C: Conditional

Response Parameters

Parameter Type Mandatory Description
responseCode
String (7)
Y
Response Code.

Format:
HTTP Code + Service Code + Error Code

Example:
200+54+00 = 2005400
responseMessage
String (150)
Y
Response description.
partnerReferenceNo
String (64)
Y
Unique code to identify the order/billing/invoice.

Example:
Transaction number, invoice ID, etc.
webRedirectUrl
String (2048)
Y
URL to redirect to the payment page.
Y: Yes, O: Optional, C: Conditional
5. 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 Headers

Content-Type:application/json
X-TIMESTAMP:2024-03-14T07:49:28+07:00
X-SIGNATURE:B0VF16Vjsxxb/rUcgZM401XH7Z9cB5mhmYnfMdkblq84akTybh9Bakmb9nJD/ttrADmUbDJDW7s6E7yYTEATCdbjPs3+xEgA53gdcM7aJP9qPcfe79GankZrRvROcICdxuN2rjYZOuzvJ9SrfG/llmGic1bM627Eiz/G4pf7e8r6MOfsBRoUqH+moBGcw+/Xh2V8hqfb64hIzb7JZNZnVV7fQN6NZ8VAWLzjmo8PFLjg390wL3Fybr0GJwHohCaxBhv6P0nxVP+P9psnljKWt8EYHHWizgSVinUa9kncRq2MEpvLwujGcSG/MteZhcKXXYNGbCO5u7qato19fWwxaw==
X-EXTERNAL-ID:6b13fe32-0a63-4af2-911b-e6c9a0f9c7f4
X-PARTNER-ID:SGWYESSISHOP
CHANNEL-ID:ESPAY
             





























Sample Request

{
    "partnerReferenceNo": "DIGORDER000001",
    "merchantId": "SGWYESSISHOP",
    "subMerchantId": "fd322d0f036c8443d6904973c1a329bd", 
    "amount": {
        "value": "10000.00",
        "currency": "IDR"
    },
    "urlParam": {
        "url": "https://yourthankyoupage.com",
        "type": "PAY_RETURN",
        "isDeeplink": "N"
    },
    "validUpTo": "2023-12-23T07:44:11+07:00",
    "pointOfInitiation": "Website",
    "payOptionDetails": {
        "payMethod": "014",
        "payOption": "BCAATM",
        "transAmount": {
            "value": "10000.00",
            "currency": "IDR"
        },
        "feeAmount": {
            "value": "10000.00",
            "currency": "IDR"
        }
    },
    "additionalInfo": {
        "payType": "REDIRECT",
        "userId": "425666",
        "userName": "Agung Setiadi Putra",
        "userEmail": "agung@agung.com",
        "userPhone": "082231838297",
        "buyerId": "12345678",
        "productCode": "OVOLINK",
        "balanceType": "CASH",
        "bankCardToken": "ESP230929094046rRD5mCT1IZkrBhJb5"
    }
}

             





















































































Sample Positive Response

{
  "responseCode": "2005400",
  "responseMessage": "Successful",
  "partnerReferenceNo": "DIGORDER000001",
  "approvalCode": "20240314180833",
  "webRedirectUrl": "https://sandbox-kit.espay.id/index/order/?url=https://google.com&paymentId=DIGORDER000001&paymentAmount=10000&commCode=SGWYESSISHOP&bankCode=014&productCode=BCAATM"
}
              


Sample Negative Response

{
  "responseCode": "4015400",
  "responseMessage": "Unauthorized. Invalid Signature from Client"
}

              


cURL

curl --location 'https://sandbox-api.espay.id/apimerchant/v1.0/debit/payment-host-to-host' \
--header 'X-TIMESTAMP: 2024-03-14T07:49:28+07:00' \
--header 'X-SIGNATURE: B0VF16Vjsxxb/rUcgZM401XH7Z9cB5mhmYnfMdkblq84akTybh9Bakmb9nJD/ttrADmUbDJDW7s6E7yYTEATCdbjPs3+xEgA53gdcM7aJP9qPcfe79GankZrRvROcICdxuN2rjYZOuzvJ9SrfG/llmGic1bM627Eiz/G4pf7e8r6MOfsBRoUqH+moBGcw+/Xh2V8hqfb64hIzb7JZNZnVV7fQN6NZ8VAWLzjmo8PFLjg390wL3Fybr0GJwHohCaxBhv6P0nxVP+P9psnljKWt8EYHHWizgSVinUa9kncRq2MEpvLwujGcSG/MteZhcKXXYNGbCO5u7qato19fWwxaw==' \
--header 'X-EXTERNAL-ID: 76d1c963-9cd6-4f15-abf7-64ebb71db1a3' \
--header 'X-PARTNER-ID: SGWYESSISHOP' \
--header 'CHANNEL-ID: ESPAY' \
--header 'Content-Type: application/json' \
--data-raw '{
"partnerReferenceNo": "DIGORDER000001",
"merchantId": "SGWDIGALLERY",
"subMerchantId": "fd322d0f036c8443d6904973c1a329bd", 
"amount": {
  "value": "10000.00",
  "currency": "IDR"
},
"urlParam": {
  "url": "https://yourthankyoupage.com",
  "type": "PAY_RETURN",
  "isDeeplink": "N"
},
"validUpTo": "2023-12-23T07:44:11+07:00",
"pointOfInitiation": "Website",
"payOptionDetails": {
  "payMethod": "014",
  "payOption": "BCAATM",
  "transAmount": {
    "value": "10000.00",
    "currency": "IDR"
  },
  "feeAmount": {
    "value": "10000.00",
    "currency": "IDR"
  }
},
"additionalInfo": {
  "payType": "REDIRECT",
  "userId": "425666",
  "userName": "Agung Setiadi Putra",
  "userEmail": "agung@agung.com",
  "userPhone": "082231838297",
  "buyerId": "12345678"
}
}
'

           





Scroll to Top