Create Transaction (Bank Partner)
(1.1 in overall diagram)
Implemented by: Partner bank · Called by: EDC App / Web
Operation
| Description |
Value |
| URL |
https://{BANK_URL}/transaction/create |
| Method |
POST |
| Key |
Value |
Remark |
| Accept |
application/json |
|
| Content-Type |
application/json |
|
| Authorization |
[bank consider] |
Bank consider any type of authorization |
Request Payload
| Field |
Type |
Required |
Remark |
merchant_id |
string |
yes |
Merchant ID at bank side |
transaction_id |
string |
yes |
Transaction reference number from EDC |
transaction_amount |
decimal |
yes |
Amount to freeze |
transaction_currency |
string |
yes |
Currency code (ISO 4217) |
transaction_description |
string |
no |
Description |
bill_type |
string |
yes |
freeze or utility |
return_url |
string |
yes |
The URL that bank will redirect to after payment completed |
callback_url |
string |
yes |
The URL that bank will send transaction details to EDC side to confirm the transaction (webhook) |
hash |
string |
yes |
Hash calculation field (ensure the data integrity). Algorithm: MD5Hash ( merchant_id + transaction_id + transaction_amount + transaction_currency + bill_type + {HASH_SECRET_KEY} ) |
Sample Code for generate hash with C
public static string CreateMD5(string input)
{
// Input value will be
// merchant_id + transaction_id + transaction_amount + transaction_currency + bill_type + HASH_SECRET_KEY
// Use input string to calculate MD5 hash
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
{
byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
return Convert.ToHexString(hashBytes); // .NET 5 +
}
}
Example Request Payload
{
"merchant_id": "EDC",
"transaction_id": "F1008XX",
"transaction_amount": 84000,
"transaction_currency": "KHR",
"transaction_description": "",
"bill_type": "freeze",
"return_url": "https://example.com/transaction/complete",
"callback_url": "https://example.com/transaction/callback",
"hash": "4be8fc1f50834aacb5c46005501cda8b..."
}
Response Payload
| Field |
Type |
Remark |
code |
string |
Response code |
message |
string |
Response message |
data |
json |
Data Object |
Response Payload for "data"
| Field |
Type |
Remark |
web_payment_url |
string |
The URL to call web payment |
mobile_deep_link |
string |
The deep link to call bank app |
Example Response Payload
{
"code": "000",
"message": "",
"data": {
"web_payment_url": "https://bankdomain/payment/....",
"mobile_deep_link": "bank://..."
}
}