Starex Pay

Starex Pay is a payment page. You redirect the customer to it with an order number and an amount, and they pick a payment method and pay. Starex Pay handles everything related to payment systems — all you have to do is build one link and implement two endpoints.

1. Overview

PAY_URL and SECRET_KEY are issued by Starex; you give Starex your prepare and complete URLs.

ItemDescription
PAY_URLBase URL of the payment page
SECRET_KEYSecret key for signatures — used only on the server side
prepare URLOrder validation endpoint
complete URLPayment confirmation endpoint

2. How it works

Customer Your website Starex Pay Payment system 1. Places an order 2. Redirect to the payment link 3. GET /checkout (order_id, amount, sign) 4. Payment method page 5. Selects a method 6. POST prepare 7. error = 0, prepare_id 8. Redirect to the payment page 9. Confirms the payment 10. Payment accepted 11. POST complete 12. error = 0, confirm_id 13. Result page

requests in green go to your endpoints; everything else is handled by Starex Pay.

4. Requests

Both requests are sent with POST and a JSON body. The response must return HTTP 200 within 10 seconds.

Prepare

POST {YOUR_PREPARE_URL}

{
  "ext_trans_id": 1042,
  "ext_payment_id": 3311,
  "order_id": "A-10245",
  "amount": 4500000,
  "action": 0,
  "sign_time": "2026-07-28 14:05:21",
  "sign_string": "9c2f...b81d"
}
FieldTypeDescription
ext_trans_idintegerPayment number in the Starex Pay system
ext_payment_idintegerTransaction number in the Starex Pay system
order_idstringOrder number in your system
amountintegerPayment amount (in tiyin)
actionintegerAction being performed. 0 — Prepare
sign_timestringRequest time. Format YYYY-MM-DD HH:MM:SS
sign_stringstring Verification string (SHA-256):
sha256(ext_trans_id + SECRET_KEY + order_id + amount + action + sign_time)
Response
{
  "error": 0,
  "error_note": "OK",
  "prepare_id": "778812"
}
FieldTypeDescription
errorintegerOperation result. 0 — success
error_notestringResult description
prepare_idstringPayment identifier in your system

Complete

POST {YOUR_COMPLETE_URL}

{
  "ext_trans_id": 1042,
  "ext_payment_id": 3311,
  "order_id": "A-10245",
  "prepare_id": "778812",
  "amount": 4500000,
  "action": 1,
  "sign_time": "2026-07-28 14:07:03",
  "sign_string": "1ae4...7c02"
}
FieldTypeDescription
ext_trans_idintegerPayment number in the Starex Pay system
ext_payment_idintegerTransaction number in the Starex Pay system
order_idstringOrder number in your system
prepare_idstringPayment identifier in your system, returned in the response to the prepare request
amountintegerPayment amount (in tiyin)
actionintegerAction being performed. 1 — Complete
sign_timestringRequest time. Format YYYY-MM-DD HH:MM:SS
sign_stringstring Verification string (SHA-256):
sha256(ext_trans_id + SECRET_KEY + order_id + prepare_id + amount + action + sign_time)
Response
{
  "error": 0,
  "error_note": "OK",
  "confirm_id": "990145"
}
FieldTypeDescription
errorintegerOperation result. 0 — success
error_notestringResult description
confirm_idstringConfirmation identifier in your system

An error returned in the complete response marks the payment as failed.

5. Returned error codes

CodeMessage shown to the customerWhen to return it
0Operation completed successfullyEverything is fine
-1Payment verification failedsign_string did not match
-2Payment amount is incorrectamount does not equal the order amount
-3Requested operation is not availableUnknown action value
-4This order has already been paidRepeated payment attempt
-5Order not foundNo order for this order_id
-6Transaction not foundNo payment for this prepare_id
-7Failed to update the order, please try againInternal failure
-8Invalid payment requestA required field is missing
-9This transaction has already been cancelledAttempt to continue a cancelled payment

A code that is not in this list is treated as a failed payment.