Processing payment API

The STCPay Process Payment API allows merchants to validate the OTP and process a payment from a customer's STCPay account.

Endpoint URL

The endpoint URL for this API is:

POST https://<server-base>/rest/pay/stcpay/processPayment

Replace with the appropriate URL depending on whether you use the production or testing server.

๐Ÿ“˜

Testing Server

The testing server base URL is https://orderpilot.paylink.sa.

๐Ÿ“˜

Production Server

The production server base URL is https://order.paylink.sa.

Request Method

The request method for this API is POST.

Request Headers

The following headers are required for a successful request:

HeaderValueDescription
Content-Typeapplication/jsonThe format of the request payload.

Request Parameters

The following parameters are required in the request payload:

ParameterTypeDescription
stcpayMobileStringThe STCPay mobile number of the customer.
stcpayMobileCountryCodeStringThe country code of the customer's mobile number.
orderNumberStringA unique identifier for the order.
totalDoubleThe total amount to be charged to the customer's STCPay account.
stcpayPaymentOTPStringThe customer received the OTP for the payment.
paymentSessionIdStringThe payment session ID is generated in the sendOtp endpoint.
signatureStringThe signature is generated in the previous step.
signedBase64DataStringThe signed data was generated in the previous step.

Successful Response Parameters

If the request is successful, the API will return an HTTP status code of 200 along with the following response:

ParameterTypeDescription
orderNumberStringThe unique identifier for the order.
orderAmountDoubleThe amount charged to the customer's STCPay account.
msgStringA message indicating the status of the payment.

Example Response

Example of a successful response:

{
    "orderNumber": "1679564751896",
    "orderAmount": 10.0,
    "msg": "Payment of order 1679564751896 has been processed."
}

Failure Response

If the request fails, the API will return an HTTP status code other than 200, along with the following response:

FieldTypeDescription
timestamplongThe timestamp of the error.
statusintThe API returns the HTTP status code.
errorstringAn explanation of the error that occurred.
pathstringThe path of the API that was called.