Custom Payments

STC Pay

9min

Introduction

Moyasar API provides the required facilities for adding STC pay payment methods to your website or system. STC pay is a digital wallet service that will allow users to utilize wallets to pay for Merchants.

Overview

This guide ensures an easy process for how to integrate STC pay into your system.

The process of making an STC pay payment is composed of the following steps:

  1. The user clicks on the
  2. OTP form is presented to the user.
  3. The user enters the OTP they receive from STC pay and verifies it.
  4. Payment details are sent securely to Moyasar servers and then processed.
  5. The user is redirected back to the URL specified in callback_url when the payment

Before Starting

Before you start integrating with Moyasar API, make sure you complete these steps:

  1. Sign up for a Moyasar test account at Moyasar's dashboard
  2. Get your API key to authenticate your API request.



Specifications

Step 1: initiate payment

Set up the payment form with an input for mobile number in your website checkout page and send a POST request to Moyasar API to initiate the payment

Include the endpoint required attributes from your side as a merchant:

Parameter

Description

amount

Should be in the smallest currency unit. eg: 100 Halals to charges 1 Riyal.

currency optional

3-letter ISO code for currency. (default: SAR)

publishable_api_key

To authenticate the payment.

description optional

This may include a description of the merchandise or the service that your customer is billed for.

source[type]

The value should be stcpay.

source[cashier] optional

The cashier ID.

source[branch] optional

The branch ID.

The user will provide the mobile number for proceeding to charge:

Parameter

Description

source[mobile]

Provided by the customer starting with 05

POST Request JSON

Request

Resoponse


Step 2: confirm payment

Once the payment is initiated successfully, handle the JSON response and then use transaction_url to pass the OTP value entered by the user to proceed with the payment by sending a GET/POST request.

Parameter

Description

otp_value

Sent to the customer by SMS.

  • GET Request JSON
GET Request

POST Request


On success, it returns the paid status payment object. If none of the requirements is met, the status will be failed.

Response