DocsEndpoints

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.com

Request body

merchant_coderequired
string

Your merchant code, e.g. M00001

reference_norequired
string

Your unique order reference

order_descriptionrequired
string

Shown on checkout

amountrequired
string

Decimal string, 2 dp, e.g. 3.00

currencyrequired
string

ISO code, e.g. MYR

frontend_return_urlrequired
string

Customer redirect target; supports the {gateway} and {txn_id} templates

backend_return_urlrequired
string

Server-to-server callback URL

channel
string

Pre-select a payment channel

product_code
string

Optional product code

customer_id
string

Your customer identifier

customer_name
string

Customer name

customer_email
string

Customer email

customer_contact
string

Customer phone

customer_ip
string

Customer 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.