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:
Header | Value | Description |
---|---|---|
Content-Type | application/json | The format of the request payload. |
Request Parameters
The following parameters are required in the request payload:
Parameter | Type | Description |
---|---|---|
stcpayMobile | String | The STCPay mobile number of the customer. |
stcpayMobileCountryCode | String | The country code of the customer's mobile number. |
orderNumber | String | A unique identifier for the order. |
total | Double | The total amount to be charged to the customer's STCPay account. |
stcpayPaymentOTP | String | The customer received the OTP for the payment. |
paymentSessionId | String | The payment session ID is generated in the sendOtp endpoint. |
signature | String | The signature is generated in the previous step. |
signedBase64Data | String | The 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:
Parameter | Type | Description |
---|---|---|
orderNumber | String | The unique identifier for the order. |
orderAmount | Double | The amount charged to the customer's STCPay account. |
msg | String | A 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:
Field | Type | Description |
---|---|---|
timestamp | long | The timestamp of the error. |
status | int | The API returns the HTTP status code. |
error | string | An explanation of the error that occurred. |
path | string | The path of the API that was called. |
Updated about 1 year ago