Sadad is a Qatari Platform to send/receive payment via online [store / Website / portal ] and mobile [applications]

Add Sadad Payment Gateway to your mobile app or website. Sadad is only one payment gateway whose provide secure payment via Credit(Visa and Master)/Debit(QPAY). Collect online and in-store payments from your customer using Debit/Credit Cards, and Sadad Balance.

Start Building with SADAD

SADAD Payment Gateway provides a secure, PCI-compliant way to accept Debit/Credit card, pay via sadad from your customers

  • Register as a Merchant in Sadad. You have to do upload Business related document. Request will go to the Sadad verification panel.
  • Once business document is verified then you can generate the secret key from Merchant panel.
  • You will get “Developer API” option in merchant panel.
  • Click on “Developer API”, provide website domain then you will receive the Secret key.

Merchant panel Login page


You can do login using your merchant credential

screenshot

Merchant panel dashboard


You will see “API” option in left side menu. From there Merchant can create the secret key.

screenshot

Understanding account credentials


Account credentials are available in your API section for production environment. These credentials consist of -

  • MID (Merchant ID/SadadId) - This is a unique identifier provided to every merchant by SADAD. MID is part of your account credentials and MID is available in Dashboard. “SadadId” is your MID.
  • Secret Key - This is a unique secret key used for secure encryption of every request. This needs to be kept on server side and should not be shared with anyone. Secret key is availble in API section.

Fundamentals of collecting payments with Sadad:


  • Your customer clicks on a pay button in your mobile application
  • Customer is shown a checkout form where he fills his payment details and authorizes the payment
  • Based on the response received, you can display order status to customer
  • See a real-time summary of payments received and other insights in your dashboard
  • Receive payments collected from customers in your transaction history page.

Detailed Payment Flow Explained


Transaction Creation

When a transaction request is received at Sadad's server, there are multiple validations carried out like a valid source of request, structure of request, uniqueness of request etc. Once these validations are passed, a transaction is created.


Successful Transaction

Customer fills basic payment details to authorize the payment. Once the authorization is successful, money is debited from the customer's account or credit/debit card. This transaction is a successful transaction.


Failed Transaction

If the customer drops out from the payment process or in the event of payment authorization failure, money is not deducted from the customer's account. This is marked as failed transaction.

Overview of payment processing via SADAD Android/IOS SDK


  • At click of the pay button by customer, Authentication request will be sent from your server to our server.
  • Our server authenticate the request and provide the authToken to your server.
  • Once authToken received in app, then order related payload is passed to our server by the app
  • This order payload is used to generate checksumhash by our server side utility and authToken.
  • SDK verifies payload and displays payment sadad checkout page
  • Customer fills the payment details and completes the payment authentication. Once the payment is complete, response is posted back to your app via callback
  • Lastly, verify transaction status with Transaction Status API via server to server call. This protects you from scenarios where your account credentials are compromised or request/response has been tampered

Web Checkout

Get the sample code:

Request Parameter Detail to post your content into the sadad page
REQUEST ATTRIBUTES
productdetail
JSON Array (Mandatory)
"productdetail": [ { "order_id": "85", "itemname": "Product 2", "amount": "800", "totalamount": "800", "quantity": "1", "type": "line_item", "item_meta": null } ]
merchant_id
String (Mandatory)
"merchant_id" is "sadad_id" and it will be get from app(in menu screen) as well as merchant panel(left side menu)
secret_key
String (Mandatory)
  • Register as a Merchant in Sadad. You have to do upload Business related document. Request will go to the Sadad verification panel.
  • Once business document is verified then you can generate the secret key from Merchant panel. Merchant panel URL is “https://webpanel.sadad.qa/authentication/login
  • You will get “Developer API” option in merchant panel. Click on “Developer API”, provide website domain then you will receive the Secret key.
ORDER_ID
String (Mandatory)
Order’s unique id/number. So in return response, merchant can get to know this response belongs to this order from order id/number.
WEBSITE
String (Optional)
Merchant website URL.
TXN_AMOUNT
String (Mandatory)
Total order amount.
CUST_ID
String (Optional)
Customer’s id. If merchant provide that then we will send back that id for merchant side response process.
EMAIL
String (Optional)
Customer’s email
MOBILE_NO
integer (Mandatory)
Customer’s mobile
CALLBACK_URL
String (Mandatory)
Will send response to given callback URL.
txnDate
String (Optional)
Transaction date.

Response Code Description

RESPCODE RESPMSG STATUS
1 Txn Success TXN_SUCCESS
400 Transaction status not confirmed yet PENDING
402 Looks like the payment is not complete. Please wait while we confirm the status with your bank PENDING
810 Txn Failed TXN_FAILURE

Pass the below Form-Data on "https://sadadqa.com/webpurchase" URL for initiate the Sadad Payment

<form action="https://sadadqa.com/webpurchase" method="post">
    <span class="tagline"><h4>Merchant Id</h4></span>
    <input type="text" name="merchant_id" id="merchant_id" value="7648426">
        
    <span class="tagline"><h4>Secret Key</h4></span>
    <input type="text" name="secret_key" id="secret_key" value="MVFd65askQv7oVIT">

    <span class="tagline"><h4>Amount</h4></span>
    <input type="text" name="TXN_AMOUNT" id="amount" value="10">
        
    <span class="tagline"><h4>Order Id</h4></span>
    <input type="text" name="ORDER_ID" id="order_id" value="SD3214578995">

    <span class="tagline"><h4>Callback URL</h4></span>
    <input type="text" name="CALLBACK_URL" id="callback_url" value="Your Callbak URL">
    
    <div class="col-md-6 col-sm-6">
        <span class="tagline"><h4>Product 1</h4></span>
        <div class="input-group">
            Quantity
            <input type="hidden" id="itemname" name="productdetail[0][itemname]" value="Product One">
            <input type="text" id="quantity" name="productdetail[0][quantity]" >
            Price
            <input type="text" id="price" name="productdetail[0][amount]">
        </div>
    </div>
    <div class="col-md-6 col-sm-6">
        <span class="tagline"><h4>Product 2</h4></span>
        <div class="input-group">
            Quantity
            <input type="hidden" id="itemname" name="productdetail[1][itemname]" value="Product Two">
            <input type="text" id="quantity" name="productdetail[1][quantity]" >
            Price
            <input type="text" id="price" name="productdetail[1][amount]">
        </div>
    </div>
    <input type="submit" value="Submit">
</form>    

Steps to start accepting payments via SADAD Android SDK

Get the sample code:

Merchant have to configure PHP code in the server before starting Android SDK.

Step 1: SDK Installation and Setup

Install SDK

Install Sadad Android SDK using Android Studio. To add the SDK to your app, add the following dependency in your build.gradle:

Steps to Integration :

Step 1. Add the JitPack repository to your project level build.gradle file
allprojects { 
  repositories { 
  maven {
      url 'https://jitpack.io' 
      }
   } 
}
Step 2. Add the dependency
dependencies {
    implementation 'com.github.SadadDeveloper:Sadad_SDK_Android:v1.1.1'
}

How to Use ?

1) Prepare Order for purchase through the SADAD.
Bundle bundle = new Bundle();
bundle.putString(SadadOrder.ACCESS_TOKEN, token);
bundle.putString(SadadOrder.CUST_ID, "123456789");
bundle.putString(SadadOrder.ORDER_ID, "528963147");
bundle.putString(SadadOrder.TXN_AMOUNT, "100.00");
bundle.putString(SadadOrder.MOBILE_NO, "9824672292");


JSONArray productDetails = getProductDetails();


if (productDetails.length() > 0) {    
    bundle.putString(SadadOrder.ORDER_DETAIL,String.valueOf(productDetails));
}


//building product details e.g. product name, product quantity, product amount
JSONArray getProductDetails() {
  JSONArray jsonArray = new JSONArray();
  JSONObject jsonObject = new JSONObject();
  try {
      jsonObject.put("itemname", "Gucci perfume");
      jsonObject.put("quantity", 1);
      jsonObject.put("amount", 1.0);
  } catch (JSONException e) {
      e.printStackTrace();
  }
  jsonArray.put(jsonObject);
  return jsonArray;
}


SadadOrder sadadOrder = new SadadOrder();
sadadOrder.setRequestParamMap(bundle);
2) Initiate Sadad SDK service.
SadadService.getProductionService();
3) Create Transaction.
SadadService.createTransaction(HomeActivity.this, sadadOrder, new TransactionCallBack() {
                              @Override
                              public void onTransactionResponse(String inResponse){


                              }


                              @Override
                              public void onBackPressedCancelTransaction() {


                              }


                              @Override
                              public void onTransactionCancel(String errorJson) {


                              }


                              @Override
                              public void onTransactionFailed(String errorJson) {


                              }
                      });

Steps to start accepting payments via SADAD IOS SDK

Get the sample code:

Merchant have to configure PHP code in the server before starting I SDK.

Step 1:installed following depenaded pods in your project.

  • 'IQKeyboardManagerSwift'
  • 'Material'
  • 'KBNumberPad'

Step2: Drag the framework 'SadadPaymentSDK' in the top of your project.

Step3: Add the framework sadadPaymentSDK in Project > General > Embedded Binaries.

Step4: Now go to the viewcontroller where you need to open or access framework and write.

import SadadPaymentSDK

How to Use ?

1) Create product array with following details.
let arrProduct:NSMutableArray = NSMutableArray()
let productDIC = NSMutableDictionary()
productDIC.setValue("GUCCI Perfume", forKey: "itemname")
productDIC.setValue(ProductOneQuantity, forKey: "quantity")
productDIC.setValue(ProductOneAmount, forKey: "amount")
arrProduct.add(productDIC)
2) Use following code for open framework from your project.
let podBundle = Bundle(for: SelectPaymentMethodVC.self)

let storyboard = UIStoryboard(name: "mainStoryboard", bundle: podBundle)

let vc = storyboard.instantiateViewController(withIdentifier: "SelectPaymentMethodVC") as! SelectPaymentMethodVC

vc.delegate = self

vc.isSandbox = false

vc.strAccessToken = strAccessToken

vc.amount = self.TotalValue()

vc.arrProductDetails = self.arrProduct

vc.modalPresentationStyle = .overCurrentContext

let navigationController = UINavigationController(rootViewController: vc)

self.present(navigationController, animated: true, completion: nil)

Steps to confiqure PHP code in server

Create a config.php file over your server and write the following code
<?php 
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
echo 'access denied';
    die;
}
/*
 * Set the credentials in below places.
 */
$secretkey = '5rQRZSC4t7Ze42Cb'; // Secret key of the merchant
$sadadid = 7648426; // Sadad id of the merchant
$registered_domain = 'www.some.com'; // Registered domain of the merchant
$type = 'sandbox'; // 'live' - For live SDK,'sandbox' - For Sandbox
?>
Create a index.php file over your server and write the following code. Replace the SadadId, SecretKey and Domain with your original details.
<?php 
if ($_SERVER['REQUEST_METHOD'] == 'GET' && realpath(__FILE__) ==
realpath($_SERVER['SCRIPT_FILENAME'])) {
echo 'access denied';
    die;
}

include 'config.php';
if (isset($type) && $type == 'live') {
    $wspath = 'https://api.sadadqatar.com/api-v2/';
} else if (isset($type) && $type == 'sandbox') {
    $wspath = 'https://sandboxapi.sadadqa.com/api/';
} else {
    echo 'Please insert valid type.';
}


$requestdata = array();
$requestip = $_SERVER['REMOTE_ADDR']; // Ip of app sdk user

$requestdata = '{
                        "sadadId": "<SadadId>",
                        "secretKey": "<SecretKey>",
                        "domain": "<Domain>" 
                    }';

$ch = curl_init($wspath . 'userbusinesses/getsdktoken');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, @$requestdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 
'Content-Length: ' . strlen(@$requestdata)));
$returndata = curl_exec($ch) . "\n";
curl_close($ch);

echo $returndata;

?>
☰ Menu
× Home Getting Started In-App Payments