Signature Payment Gateway

All Requests from Espay Server will include a signature parameter. All merchants should validate this parameter to make sure the request is only coming from espay server.

The transaction signature is generated by assembling parameters with ##, uppercase those string assembled parameters, hash using SHA256 algorithm, and the seeds to construct the transaction signature are as follows:

Send Invoice

To send invoice signature, sort the parameters in the following order:

  1. Signature Key(Key)
  2. Key used to generate the signature, provided by Espay Integration Team

  3. rq_uuid
  4. Request uuid sent by web service.

  5. rq_datetime
  6. Request date/time parameter, which is available upon request

  7. order_id
  8. Merchant order id.

  9. Amount
  10. Transaction amount.

  11. Ccy
  12. Currency.

  13. comm_code
  14. Comm_code.

  15. Mode
  16. the value is: SENDINVOICE

Example

##7bc074f97c3131d2e290a4as##UUID001##2016-07-25
11:05:49##145000065##10000##IDR##SGWTES##SENDINVOICE##

Closed Invoice

For Closed Invoice Signature, the parameters are in the following order:

  1. Signature Key(Key)
  2. The key used to generate signature (provided by Espay Team).

  3. rq_uuid
  4. The UUID request sent within web service.

  5. rq_datetime
  6. The date/time request sent within web service.

  7. order_id
  8. Merchant order id.

  9. Comm_code.
  10. Comm Code

  11. Mode
  12. The value is: CLOSEDINVOICE

Example

##7bc074f97c3131d2e290a4707a54a623##UUID001##2016-07-25
11:05:49##145000065##SGWTES##CLOSEDINVOiCE##

Transaction Inquiry, Payment notification, Check Payment Status & Update Expire
They have the same order

##KEY##rq_datetime##order_id##mode##

Below is the explanation:

  1. Signature Key(Key)
  2. The key used to generate signature (provided by Espay Team)

  3. rq_datetime
  4. Date/time parameter available upon request

  5. order_id
  6. Merchant order or transaction id

  7. Mode
  8. this parameter differentiates the signature for each request. This mode consists of

    • INQUIRY
    • if request is Transaction Inquiry
    • PAYMENTREPORT
    • if request is Payment notification
    • CHECKSTATUS
    • if request is Check Payment Status
    • EXPIRETRANSACTION
    • if request is Update Expire Transaction

Example

##7bc074f97c3131d2e290a4707a54a623##2016-07-25 11:05:49##145000065##INQUIRY##
          
##7BC074F97C3131D2E290A4707A54A623##2016-07-25 11:05:49##145000065##PAYMENTREPORT##

The followings are the steps for signature generating process:

  1. Combine parameter with ##
  2. example of string signature after be assembled

    ##7bc074f97c3131d2e290a4707a54a623##2016-07-25 11:05:49##145000065##INQUIRY##
          
  3. Uppercase combined strings
  4. example of string signature after uppercase

    ##7BC074F97C3131D2E290A4707A54A623##2016-07-25 11:05:49##145000065##INQUIRY##
          
  5. Hash with sha256
  6. example of string signature after sha256

    67747e2e6b219879563655eb012f77646b9792736f5693f2e44693fec5a67d26
          
    

Example of signature code generating using php code :

$uppercase = strtoupper('##7bc074f97c3131d2e290a4707a54a623##2016-07-25 11:05:49##145000065##INQUIRY##'); $signature = hash('sha256', '$uppercase');
    

Example of signature code generating using java :

import java.io.FileInputStream; import java.security.MessageDigest; /** * * @author root */ public class SHACheckSumExample { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception{ // TODO code application logic here String password ="##7bc074f97c3131d2e290a4707a54a623##2016-07-25 11:05:49##145000065##INQUIRY##"; Confidential © Espay Page 23 of 27 PT.Square Gate One String data = password.toUpperCase(); System.err.println(data); MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(data.getBytes()); byte byteData[] = md.digest(); //convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100,16).substring(1)); } System.out.println("Hex format : " + sb.toString()); } }