Initiate a payment
Creates a payment session and returns a hosted payment URL.
POSThttps://pay.syok2pay-sandbox.com/v1/initiate
Base URL
https://pay.syok2pay-sandbox.comRequest body
merchant_coderequiredYour merchant code, e.g. M00001
reference_norequiredYour unique order reference
order_descriptionrequiredShown on checkout
amountrequiredDecimal string, 2 dp, e.g. 3.00
currencyrequiredISO code, e.g. MYR
frontend_return_urlrequiredCustomer redirect target; supports the {gateway} and {txn_id} templates
backend_return_urlrequiredServer-to-server callback URL
channelPre-select a payment channel
product_codeOptional product code
customer_idYour customer identifier
customer_nameCustomer name
customer_emailCustomer email
customer_contactCustomer phone
customer_ipCustomer IP
Example request
bash
curl -X POST https://pay.syok2pay-sandbox.com/v1/initiate \
-H "Authorization: Bearer pk_..." \
-H "X-Timestamp: 1714280400" \
-H "X-Signature: <hmac>" \
-H "Content-Type: application/json" \
-d '{
"merchant_code": "M00001",
"reference_no": "ORD-20260428-003",
"order_description": "Payment for Order #001",
"amount": "3.00",
"currency": "MYR",
"frontend_return_url": "https://store.example/payment/return?gw={gateway}&txn_id={txn_id}",
"backend_return_url": "https://store.example/payment/callback?gw={gateway}&txn_id={txn_id}",
"customer_email": "john@example.com"
}'
Example response
json
{
"success": true,
"data": {
"session_id": "cs_abc123",
"txn_id": "txn_abc123",
"status": "PENDING",
"amount": "3.00",
"currency": "MYR",
"reference_no": "ORD-20260428-003",
"merchant_name": "Example Store",
"expires_at": "2026-04-28T12:30:00Z",
"payment_url": "https://pay.syok2pay-sandbox.com/payment?session_id=cs_abc123"
},
"trace_id": "xid_abc123"
}
Redirect the customer to data.payment_url.