A payment link is a service Espay Payment Gateway provides that allows you to send payment links to customers without needing integration with a website or e-commerce platform. You can generate payment links and send them through various platforms such as email, SMS, WhatsApp, or social media. Using a Payment Link makes the online payment process simpler for customers.
Before Integration
Make sure you have received the credentials from the Espay team.
Integration Steps
You can use the following steps to integrate with Payment Link.
1. Generate Signature
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.
2. Data Encryption
Data encryption is transforming information into an unreadable format to ensure its security. Whenever performing transactions, you must encrypt all the parameters you send.
openssl_encrypt($plainString, ‘AES-256-CBC’, $key, 0, $iv);
Below are the encryption requirements used:
Name Description
Encryption
AES 256
Mode
CBC
Key
32 bytes.

Provided by the Espay team.
IV
16 bytes.

Provided by the Espay team.
Output
Base64

Steps for Data Encryption:

1. Hashing the Key parameter

Key Format before Hashing
12345678901234567890123456789012
Key Format after Hashing
e1b85b27d6bcb05846c18e6a48f118e89f0c0587140de9fb3359f8370d0dba08

2. Hashing and Substring of the IV parameter

Hashing the IV parameter, then take a substring of 16 characters starting from index 0.
IV Format before Hashing
1234567890123456
IV Format after Hashing
7a51d064a1a216a692f753fcdab276e4ff201a01d8b66f56d50d4d719fd0dc87
Format IV after substring (16 characters from index 0)
7a51d064a1a216a6

3. Encrypt and encode each parameter using base64

Encrypt and encode all parameters that will be used in the payment link.
Order id before encrypt and encode.
PAYLINK0312242
Order id after encrypt and encode.
Y0dpR3FrWnZ0emNoVEtlYWpEZ2NXQT09
3. Create Inquiry and Payment

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

Flow

You generate the link using the parameters and URL provided by ESPAY. Then, you can give the generated link to your customer.

API URL

Environment URL
Sandbox
Port of HTTPS (443)
https://sandbox-portal.espay.id/paylink?orderid=xxx&commcode=xxx&amount=xxx&datetime=xxx
&detail=xxx&backurl=xxx&signature=xxx
Production
Port of HTTPS (443)
https://paylink.espay.id/checkout?orderid=xxx&commcode=xxx&amount=xxx&datetime=xxx&detail=xxx&backurl=xxx&signature=xxx

Request Parameters​

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

Example:
Transaction number, invoice ID, etc.
commcode
AN (32)
Y
Merchant code from Espay team.

Example:
SGWYESSISHOP
amount
N (13.2)
Y
Paid amount.

Format:
Decimal .00 (ISO 4217)

Example:
150000.00
datetime
ANS (19)
Y
Transaction date and time from the merchant server.

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

Example:
2024-03-14 07:49:28
detail
JSON
Y
  ITEM_NAME
AN (32)
Y
Item name.

Example:
Item1
  AMOUNT
N (15)
Y
Item price.

Example:
10000
  QUANTITY
N (15)
Y
Quantity.

Example:
2
  TOTAL_AMOUNT
N (15)
Y
Total.

Example:
20000
  OTHERS
AN (32)
Y
Other information.

Example:
Promo
  AMOUNT
AN (15)
Y
Total.

Example:
1000
backurl
ANS
Y
URL to direct to the merchant page.
signature
ANS (64)
Y
Code used to validate transactions. Learn Signature.
Y: Yes, O: Optional, C: Conditional

Data Type

Type Description
A
Alpha character
N
Numeric character
S
Special character
AN
Alphanumeric character
AS
Alpha dan special character
NS
Numeric dan special character
ANS
Numeric dan special character
5. After Payment

Espay Payment Gateway menyediakan API Opsional yang dapat Anda gunakan untuk mendukung kebutuhan pembayaran lainnya.



Sample - PHP Encryption

                  
// versi

$plainString = "PAYLINK0312242";  // Nilai yang akan dienkripsi
$key = "12345678901234567890123456789012";  // Kunci sepanjang 32 bytes
$iv = "1234567890123456";  // IV sepanjang 16 bytes

$encrypt = openssl_encrypt($plainString, 'AES-256-CBC', $key, 0, $iv);

$result = base64_encode($encrypt);

//versi 2

$plainString = "PAYLINK0312242";  // Nilai yang akan dienkripsi
$key = hash('sha256', '12345678901234567890123456789012');  // Kunci sepanjang 32 bytes
$iv = substr(hash('sha256', '1234567890123456'), 0, 16); // IV sepanjang 16 bytes

$encrypt = openssl_encrypt($plainString, 'AES-256-CBC', $key, 0, $iv);
$result = base64_encode($encrypt);


             


Format Detail Order:

[
    {
        "ITEM_NAME": "item1",
        "AMOUNT": "20000",
        "QUANTITY": "2",
        "TOTAL_AMOUNT": "40000"
    },
    {
        "ITEM_NAME": "item2",
        "AMOUNT": "10000",
        "QUANTITY": "2",
        "TOTAL_AMOUNT": "20000"
    },
    {
        "OTHERS": "Shipping fee",
        "AMOUNT": "5000"
    },
    {
        "OTHERS": "Promo",
        "AMOUNT": "1000"
    }
]
             


Sample - Payment Link:

https://sandbox-
portal.espay.id/paylink?orderid=VktlMEJwRjZFL0ZSWHg2K3hIZFZRZzNoaWN4cm1PQmN0anZBaEx4L21IQT0=&commcode=
aGlWb3F5cmlGSEJvdUhGb0pLMllOdz09&amount=MHZ2ckVSRDJ3M010TjhLQ2plTWpRZz09&datetime=cEhVaFhHNi9Na2F
yQ3Y0RnpHUHBMWlhJMHZMekVxV0FETStzNkFRZHNFMD0=&detail=eTJCTzE4Y2hQMGFtSVRxcDhkMFpZYWtsdlI5MVErT0
NVc0dzQnYrcGVPRWl3cjV5ZXNITUdqcmJNQU1TQ1JvMVZKN1RIOUdHcklOK2FucmFFZXNoUXhoMVluVm9LUjRLV3ZlYjJ2S0d
Rcks5Ui84b1FKcUZ1OUh0UWpzdDJEZTBjK1M3ODdvaGR3TzA0UHVObFpnVVoxeCtTb1ZHdFF6NXNQZzV3a0JoMFVQOUR2W
CtYdlRxOHZnc2ttRnd0QjVsd3JtMjgrTzY2MndJZDFLK2k3MGxFZ1Z1SStvWmFVejI3RHFJOE5KMFBSa0lyV2hPTEdFdC9DbTRGR
npRUWU2SDBheWlLWVRWUDBoSmVrdytzaGFML01YTDdhR3R0dGE3cnV1NUFmUTFSaUY5VWJ5bFRmV1ZkNExPU0hvMFo
3K3k=&signature=Rno2Vm9DZnFDZG5keTliamlRSnVmZTJFbU4zTHVxQjNZY2JXVk9JY1hRZldRd3pKOUs5Zk1uc2VmREZCSWN
TbThuSE5hK0xuRmlPVnNqNnNzSktYanBJRWliRE9xbjlCZG9ueVVCYWdnc2c9&backurl=emp2cjNxUElFUnk5bEpLNCt4NU5UM
0RXN25HYVV3K2w2K1kwZVZzbXNUVHBtMm9qY0xnK2cvQ29YajdzdzdRWA==
             


CURL
Scroll to Top