Credit Card


Signature

All requests to and from the Espay server require a signature parameter. All traders must validate this parameter to ensure that the request only comes from the Espay server and the Merchant server.

Transaction signatures are generated using the SHA256 hash algorithm. The following explains how to generate transaction signatures:

  1. Signature key: A key is used to generate a signature that is provided by the Espay Integration Team
  2. comm_code: Parameter dealer code provided by the Espay Integration Team
  3. trx_id: Transaction ID of the merchant
  4. amount: Amount of the dealer

The order of signature combining process is as follows:

Tokenization:

  1. Signature Key
  2. comm_code
  3. trx_id
  4. amount

Capture:

  1. Signature Key
  2. comm_code
  3. trx_id
  4. amount

Void:

  1. Signature Key
  2. comm_code
  3. trx_id

These fields must be arranged in the following order, separated by ##

##comm_code##trx_id##amount##

Next, the string must be converted to UPPERCASE before the hash is performed.
Example :

##SGWTEST##test001##100000##

All strings must be capitalized as follows:

##SGWTEST##TEST001##100000##

Results according to Hashes and Algorithm256

d0f8d02e651802c0c6984794adc78c9b09cd53d504ee13456d8ee2121d20

Tokenization

This process is used when the merchant already has credit card information provided by Espay and wants to make transactions with the token.

Flow Message

Merchant → Espay

Method

HTTP Post

API URL

Development : https://sandbox-api.espay.id/rest/creditcard/tokenpayment

Production : https://api.espay.id/rest/creditcard/tokenpayment

Parameter Request:

Parameter Name Max Length Mandatory Description
comm_code 32 Yes Dealer code registered at Espay
masked_card_no 20 Yes Masked credit card number
store_card_number 20 Yes Token given by Espay
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
description 19 Yes Payment Description
cardname 32 Yes Name of the credit card holder
email 32 Yes Credit card holder's email
ccy 5 Yes Currency
amount 20 Yes Payment amount
call_back_url 32 No Url back
signature 64 Yes The signature is created by the dealer and validated by Espay. More information can be found on this page

After making a request using the example above, the client receives a response as follows:

Parameter Response:

Parameter Name Max Length Mandatory Description
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
error_code 4 Yes Web service error code, 0000 = Successful, 9999 = Failed / timed out
error_code is only used to report the success / failure of this service as the status of successful / failed payments is sent through the payment notification service
error_description 32 Yes Error description

Capture Payment

This process is used when the trader wants to capture a transaction that is currently in progress.

Flow Message

Merchant → Espay

Method

HTTP Post

API URL

Development : https://sandbox-api.espay.id/rest/creditcard/capturepayment
Production : https://api.espay.id/rest/creditcard/capturepayment

Parameter Request:

Parameter Name Max Length Mandatory Description
rq_uuid 64 Yes Request ID. Unique ID to identify this message with other messages
rq_datetime 19 Yes Date and time on the partner server at which the message was sent
comm_code 32 Yes Dealer code registered at Espay
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
amount 20 Yes Payment amount
signature 64 Yes The signature is created by the dealer and validated by Espay. More information can be found on this page

After making a request using the example above, the client receives a response as follows:

Parameter Response:

Parameter Name Max Length Mandatory Description
rq_uuid 4 Yes Request ID. Unique ID to identify this message and other messages
rs_datetime 32 Yes The date and time of the Espay server on which the reply message was sent
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
status_transaction 32 Yes Enter the current transaction status
S: success
Q: Failed
error_code 4 Yes Web service error code, 0000 = Successful, 9999 = Failed / timed out
error_code is only used to report the success / failure of this service as the status of successful / failed payments is sent through the payment notification service
error_description 32 Yes Error description

Void Payment

This process is used when the trader wants to cancel an ongoing transaction.

Flow Message

Merchant → Espay

Method

HTTP Post

API URL

Development : https://sandbox-api.espay.id/rest/creditcard/voidpayment

Production : https://api.espay.id/rest/creditcard/voidpayment

Parameter Request:

Parameter Name Max Length Mandatory Description
rq_uuid 64 Yes Request ID. Unique ID to identify this message with other messages
rq_datetime 19 Yes Date and time on the partner server at which the message was sent
comm_code 32 Yes Dealer code registered at Espay
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
signature 64 Yes The signature is created by the dealer and validated by Espay. More information can be found on this page

After making a request using the example above, the client receives a response as follows: Parameter Response:

Parameter Response:

Parameter Name Max Length Mandatory Description
rq_uuid 4 Yes Request ID. Unique ID to identify this message and other messages
rs_datetime 32 Yes The date and time of the Espay server on which the reply message was sent
trx_id 32 Yes A unique transaction ID number to identify the order / settlement / invoice.
status_transaction 32 Yes Enter the current transaction status
S: success
Q: Failed
error_code 4 Yes Web service error code, 0000 = Successful, 9999 = Failed / timed out
error_code is only used to report the success / failure of this service as the status of successful / failed payments is sent through the payment notification service
error_message 32 Yes Error message
























































































































Sample Response: Tokenization

{ "trx_id": "test001", "error_code": "0000", "error_message": "Success" }


















































Sample Response: Capture Payment

{ "rq_uuid": "capturepay001", "rs_datetime": "2018-08-15 10:33:00", "trx_id": "ESP1534245432RZRH", "status_transaction": "F", "error_code": "0000", "error_message": "Success" }























































Sample Response: Void Payment

{ "rq_uuid": "capturepay001", "rs_datetime": "2018-08-15 10:33:00", "trx_id": "ESP1534245432RZRH", "status_transaction": "F", "error_code": "0000", "error_message": "Success" }