Skip to main content

Create a Payment

Purchase​

To create a payment that will let the customer pay using a credit card, debit card Mada, applePay, stcPay, etc...,
or any saved card or authorized transaction, you will be making a purchase (Authentication request ) to /api/v1/session/.

The requirement to create a purchase request ( Authentication request )​

You must sign up for a test account here.
Follow the steps here.

Getting your merchant key and your password makes you ready to create an online transaction.
Both can be found in the

<Circled_sketch>merchant dashboard

Make payments​

To run payments in your application use POST /api/v1/sessions/ request to register payments and receive the redirect_url. After the payment is processed, the gateway will redirect the client back to your website (take note of the success_url, cancel_url).

Tokenization​

You can save the customer's card data so that they can reuse it for future payments.
In the callback_notification, you will receive the card token used for future payments. To learn more about tokenization, check saving the card.

Check the payment status​

You have three options to check payment status:

  1. Use the success_url pramater of the Authentication request object.
  2. Use the GET /api/v1/payment/status request.
  3. Set up a callback_url in the dashboard to listen for events.

Sample Request​

Below is a sample request body with only the mandatory fields.

{
"merchant_key": "1d903ea0-e8dc-11ed-bbba-d60e6b1bd8d8",
"operation": "purchase",
"methods": ["card"],
"order": {
"number": "order-1234",
"amount": "1.00",
"currency": "SAR",
"description": "gift"
},
"cancel_url": "https://example.com/cancel",
"success_url": "https://example.com/success",
"hash": "416830ec3be6ac7c6ca539a4e9dbdd5c8971097d"
}

Sample response​

{
"redirect_url": "{{redirect_url}}"
}
note

The redirect_url will have one houre session and it will expire after that.
The link will become invalid after successful payment.