Processing Payment
This endpoint allows merchants to validate the OTP and process a payment from a customer's STCPay account.
Endpoint
POST /rest/pay/stcpay/processPayment
Request Headers
Header | Required | Description |
---|---|---|
Accept | Yes | It must be set to application/JSON. |
Content-Type | Yes | It must be set to application/JSON. |
{
"Accept": "application/json",
"Content-Type": "application/json"
}
Request Body Parameters
Parameter | Type | Description |
---|---|---|
stcpayMobileCountryCode | String | The country code of the customer's mobile number. |
stcpayMobile | String | The STCPay mobile number of the customer. |
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 received OTP code to the customer to process 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 . |
An example of the request is as follows:
{
"stcpayMobileCountryCode": "966",
"stcpayMobile": "512345678",
"orderNumber": "16791237111116",
"total": 10,
"stcpayPaymentOTP": "12345",
"paymentSessionId": "641c1fec04e8e7793c123455",
"signature": "NTkzMjU2MzFhYmIwNGY4****",
"signedBase64Data": "NTk5OTI1NDc3NjQxYz****"
}
Successful Response
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 of a successful response:
{
"orderNumber": "16791237111116",
"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 | Integer | 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. |
Here is an example failure response:
{
"timestamp": 1679566267336,
"status": 500,
"error": "Internal Server Error",
"path": "/rest/pay/stcpay/sendOtp"
}
Updated 6 months ago