Thawani Checkout API Documentation

Introduction

  • Congratulation on considering Thawani Checkout as one of your Payment Service Providers. Thawani Checkout is a payment gateway that allows you to collect payments from your customers.
  • Merchant
    • Prepare a valid JSON request as per the integration documentation.
    • Sending request to the proper endpoint server that is mentioned in the integration documentation.
    • Redirect user to the provided payment link upon the successful generation of the link.
    • Update Merchant invoices and/or payment system.
    • Check periodically/once for changes on payment status.

    Thawani
    • Return back the payment link to the merchant.
    • Process user’s card payment or in-app payment.
    • Send OTP through the user bank card’s phone number that is registered in the bank.
    • Send payment result response bank.
    • Once the integration is completed, a test entry will be made and we will print the receipt for checking and verification – to be signed be the merchant before sending the production API and public key.

    Important Notes
    • The code sample is for demonstration purposes only. It should NOT be used as a base to develop the integration.
    • Thawani does NOT supply any plugin for any eCommerce platform.
    • All communication MUST be through emails ONLY.
    • Please provide an email that will direct all automatic communications and notifications.
    • Secret and Publishable keys are only for your company/organization purposes, NOT to be shared.
    • We do our level best to serve as much merchants as possible from Sunday to Thursday between 9:00AM until 3:00PM and in working days only.
  • In order to move your system to production environment, you need to meet the following requirements:

    • - SSL Certificate.
    • - Customer information passed on metadata (Name, Contact number, & Email address).
    • - Payment display dialogue box should contain message that indicates accepts card payments
  • Before using the eCommerce, you must make sure that configuration in the Merchant portal is set properly. There are 3 main functions:
    • Integration Keys: generate integration keys (secret and publishable key)
    • Webhook URL: Set the webhook URL to receive the payment notification
    • Payment Methods: Set what payments can be received in Thawani Checkout.
  • You MUST provide Secret and Publishable Keys in order to call any request in Thawani Checkout. Each merchant will have his unique keys which he can generate from the merchant portal directly. For testing purposes, below is the keys that will help you while integrating. Note that this is in UAT ONLY. If you need to move to production, then contact Thawani Sales to register with Thawani as a merchant and get your own keys.

    Secret Key: [your-secret-key-here]

    Publishable Key: [your-publishable-key-here]

Session

  • This endpoint is the first step to create the payment link. Sending the proper parameters in the request will result in returning a set of values that include session_id which will be used later to redirect the user to complete the payment.
  • To redirect the user to pay, a URL MUST be constructed in the specific format.
  • This endpoint will return all information about sessions as per the limit. Limit is a number of records to be returned in descended order.
  • This endpoint will return all information about sessions as per the passed receipt number parameter.
  • This endpoint will return all information about sessions as per the passed reference number parameter.
  • This endpoint will return all information about sessions as per the limit. Limit is a number of records to be returned order in descended order.

Webhook

The response back from Thawani Checkout to the merchant listener URL.

  • A webhook is a method of augmenting or altering the behavior of a web page or web application with custom callbacks. These callbacks may be maintained, modified, and managed by the merchant and merchant's developers who may not necessarily be affiliated with the originating website or application. We send the payment result after changing of status in the session to the URL that is defined in the merchant portal.

Customers

  • In order to get payment card token, you must first create the customer that is using this card. This will return a JSON file with customer identification which will be used later for all the tokenization purposes.
  • This endpoint is used to get the information about a single customer that has been previously registered.
  • This endpoint is used to get the information about all customers that have been previously registered.
  • This endpoint is used to remove a single customer that has been previously registered from the merchant customers list.

Payment Methods

  • This endpoint will return the card token that has been stored against a specific customer using the customer token which was created previously. Use this method to retrieve the card token and include it in the “create session” endpoint to process payment.
  • This endpoint is used to remove specific payment method for the customer.

Payments Transactions

  • Return back the details of a payment that has been initiated against a single sessions. This will have 3 status once bank card information submitted and OTP screen is shown. If the user exit the OTP screen the status will be "Inprocess". If payment is failed, status will be "failed". If payment is successfully completed, the status will be "successful".
  • Return back the details of a payment that has been initiated against multiple sessions. This will have 3 status once bank card information submitted and OTP screen is shown. If the user exit the OTP screen the status will be "Inprocess". If payment is failed, status will be "failed". If payment is successfully completed, the status will be "successful".

Refunds

  • Return payment for a single successful payment base on the payment identification.
  • Return back the details of a single refund transactions.
  • Return back the details of a multiple refund transactions.

Payment Intent

  • This endpoint will be used for creating a payment intent against a payment method (tokenized card). This will allow the merchant to process the payment without asking each time the user to enter their card details as long as they save (tokenize) the card in the initial payment.
  • After creating payment intent, it needs to be confirmed. This endpoint will be used for to confirm the payment method "Payment Method - Card" and/or the amount.
  • This endpoint will be used to cancel any given payment intent that has been created bu passing the payment intent ID.
  • This endpoint will allow you to trigger an enquiry about payment intent.
  • Get details of payment intent base on passed reference.
  • Get detailed list of all payment intents.

Support

  • If you require a support in integrating with Thawani eCommerce, please visit our developer’s portal in the following web address:
    https://developer.thawani.om/
    Or send your inquiries to our dedicated support team with the following email address:
    [email protected]"

Test Cards

  • For testing purposes, we provide the developer with a card that will always respond with success.
  • For testing purposes, we provide the developer with a card that will always respond with failure.

Thawani Checkout Introduction

Thawani Checkout Introduction

Images

Workflow

Thawani Checkout Overall Workflow.
Workflow

Thawani Checkout Introduction Code Example

Thawani Checkout Introduction Questions & Answers

Roles and Responsibilities

Roles and Responsibilities

Roles and Responsibilities Code Example

Roles and Responsibilities Questions & Answers

Checklist

Checklist

Checklist Code Example

Checklist Questions & Answers

Merchant Portal Configuration

Merchant Portal Configuration

Images

Keys

This window will allow you to generate secret_key and publishable_key for each branch so it can be used in the integration of the payment with Thawani Checkout.
Keys

Webhooks

Here you can configure the webhook (callback URL) where all results of payments from Thawani Checkout will be sent to this URL.
Webhooks

Payment Methods

Select which payment method are accepted in Thawani Checkout.
Payment Methods

Merchant Portal Configuration Code Example

Merchant Portal Configuration Questions & Answers

Secret and Publishable Keys

Secret and Publishable Keys

Secret and Publishable Keys Code Example

Secret and Publishable Keys Questions & Answers

Create Session

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/checkout/session

POST PRODUCTION

https://checkout.thawani.om/api/v1/checkout/session

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
client_reference_id Yes Numerical

Description: A Number that references the client. This MUST be provided by the merchant.

Location: BODY

products Yes JSON

Description: Values that define the checkout price and what the customer is charged for. It must contain the following data:

  • name: Name of the product
  • unit_amount: selling price per unit
  • quantity: number of units
    • Location: BODY

success_url Yes URL

Description: Valid URL to redirect the user after a successful payment.

Location: BODY

cancel_url Yes URL

Description: Valid URL to redirect the user after failed payment attempt.

Location: BODY

metadata No JSON

Description: Extra fields that allow to store additional information about the transaction and it is limited to 10 fields only.

Location: BODY

JSON Examples
Example Name
Request in JSON format

{
    "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "cancel_url": "", "success_url": "", "client_reference_id": ""
}

Respond in JSON format

{
    "code": 2004, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session generated successfully"
}

Notes
  • Selling Price in Product parameter must be as an Integer value e.g. for ( 0.200 OMR ) you have to input ( 200 ) likewise if you want to request (20/- OMR) you have to input ( 20000 ). Decimals are NOT allowed.
  • Our system will do the calculation for the line total and the overall amount base on the given details in the request.
  • The session will be created to be used once only.
  • Expiry Date will be by default for ONE day only.

Create Session

Images

Mobile View

Desktop and Tablet View

Create Session Code Example

Code Example

PHP

												$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/checkout/session",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"client_reference_id": "123123","products": [{"name": "Mobile Phone","unit_amount": 2000,"quantity": 3},{"name": "Kage","unit_amount": 1500,"quantity": 1}],"success_url": "https://google.com","cancel_url": "https://youtube.com","metadata": {"customer": "Thawani User","order_id": 10}}',
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: "
  ],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
	echo "cURL Error #:" . $err;
} else {
	echo $response;
}
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/checkout/session");
var request = new RestRequest(Method.POST);
request.AddHeader("thawani-api-key", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"client_reference_id\": \"123123\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Mobile Phone\",\n\t\t\t\"unit_amount\": 2000,\n\t\t\t\"quantity\": 3\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Kage\",\n\t\t\t\"unit_amount\": 1500,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://google.com\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"customer\": \"Thawani User\",\n\t\t\"order_id\": 10\n\t}\n}\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
											

HTTP

												POST /api/v1/checkout/session HTTP/1.1
Thawani-Api-Key: 
Content-Type: application/json
Host: uatcheckout.thawani.om
Content-Length: 383

{
	"client_reference_id": "123123",
	"products": [
		{
			"name": "Mobile Phone",
			"unit_amount": 2000,
			"quantity": 3
		},
		{
			"name": "Kage",
			"unit_amount": 1500,
			"quantity": 1
		}
	],
	"success_url": "https://google.com",
	"cancel_url": "https://youtube.com",
	"metadata": {
		"customer": "Thawani User",
		"order_id": 10
	}
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/session",
  "method": "POST",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Type": "application/json"
  },
  "processData": false,
  "data": "{\n\t\"client_reference_id\": \"1234567890\",\n\t\"customer_id\": \"\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Kage Testing Void\",\n\t\t\t\"unit_amount\": 100,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://developer.thawani.om/\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"Customer name\": \"Falah Al Lawati\",\n\t\t\"order id\": 9875\n\t}\n}\n"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = "{\n\t\"client_reference_id\": \"123123\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Mobile Phone\",\n\t\t\t\"unit_amount\": 2000,\n\t\t\t\"quantity\": 3\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Kage\",\n\t\t\t\"unit_amount\": 1500,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://google.com\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"customer\": \"Thawani User\",\n\t\t\"order_id\": 10\n\t}\n}\n"

headers = {
    'thawani-api-key': "",
    'Content-Type': "application/json"
    }

conn.request("POST", "/api/v1/checkout/session", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

GO

												package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/checkout/session"

	payload := strings.NewReader("{\n\t\"client_reference_id\": \"123123\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Mobile Phone\",\n\t\t\t\"unit_amount\": 2000,\n\t\t\t\"quantity\": 3\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Kage\",\n\t\t\t\"unit_amount\": 1500,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://google.com\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"customer\": \"Thawani User\",\n\t\t\"order_id\": 10\n\t}\n}\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("thawani-api-key", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/checkout/session",
  "headers": {
    "thawani-api-key": "",
    "Content-Type": "application/json",
    "Content-Length": "383"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({
  client_reference_id: '123123',
  products: [
    {name: 'Mobile Phone', unit_amount: 2000, quantity: 3},
    {name: 'Kage', unit_amount: 1500, quantity: 1}
  ],
  success_url: 'https://google.com',
  cancel_url: 'https://youtube.com',
  metadata: {customer: 'Thawani User', order_id: 10}
}));
req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/checkout/session")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["thawani-api-key"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n\t\"client_reference_id\": \"123123\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Mobile Phone\",\n\t\t\t\"unit_amount\": 2000,\n\t\t\t\"quantity\": 3\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Kage\",\n\t\t\t\"unit_amount\": 1500,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://google.com\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"customer\": \"Thawani User\",\n\t\t\"order_id\": 10\n\t}\n}\n"

response = http.request(request)
puts response.read_body
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/checkout/session")
  .header("thawani-api-key", "")
  .header("Content-Type", "application/json")
  .body("{\n\t\"client_reference_id\": \"123123\",\n\t\"products\": [\n\t\t{\n\t\t\t\"name\": \"Mobile Phone\",\n\t\t\t\"unit_amount\": 2000,\n\t\t\t\"quantity\": 3\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Kage\",\n\t\t\t\"unit_amount\": 1500,\n\t\t\t\"quantity\": 1\n\t\t}\n\t],\n\t\"success_url\": \"https://google.com\",\n\t\"cancel_url\": \"https://youtube.com\",\n\t\"metadata\": {\n\t\t\"customer\": \"Thawani User\",\n\t\t\"order_id\": 10\n\t}\n}\n")
  .asString();
											

Create Session Questions & Answers

Questions & Answers
  1. What is the limit of creating sessions?

    There is no limitation on creating sessions.

  2. What is the maximum number or products that can be added in creating a session

    The maximum limit of products that can be added while creating a session is 30 products only.

Redirect User to Pay

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/pay/[your-session-id]?key=[your-publishable-key-here]

GET PRODUCTION

https://checkout.thawani.om/pay/[your-session-id]?key=[your-publishable-key-here]

Redirect User to Pay

Redirect User to Pay Code Example

Redirect User to Pay Questions & Answers

Get Single Session Details

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/checkout/session/

GET PRODUCTION

https://checkout.thawani.om/api/v1/checkout/session/

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
Session_id Yes Numerical

Description: Number that reference the client. This MUST be provided by the merchant.

Location: URL

URL Examples
Example Name
Uat: Full Session Information Request URL

https://uatcheckout.thawani.om/api/v1/checkout/session/[your-session-id]

Production: Full Session Information Request URL

https://checkout.thawani.om/api/v1/checkout/session/[your-session-id]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session retrieved successfully"
}

Get Single Session Details

Get Single Session Details Code Example

Code Example

Java

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

HTTP

												GET /api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
	'thawani-api-key': ""
}

conn.request("GET", "/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_940RmwSubopVnPj5HadK6NZ5blpUdrx0mCSOGPqDd5YVei8eTS")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/checkout/session/checkout_NaHO04OY2D0BWTDHJBV4Zr2X1cYywNuJnPxxJt9zGzy2Ps8kf2",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

Get Single Session Details Questions & Answers

Get Single Session Details by Receipt Number

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/checkout/receipt/

GET PRODUCTION

https://checkout.thawani.om/api/v1/checkout/receipt/

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
URL Examples
Example Name
Uat: Full Session Information by Receipt

https://uatcheckout.thawani.om/api/v1/checkout/receipt/[receipt-number]

Production: Full Session Information by Receipt

https://checkout.thawani.om/api/v1/checkout/receipt/[receipt-number]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session retrieved successfully"
}

Get Single Session Details by Receipt Number

Get Single Session Details by Receipt Number Code Example

Code Example

HTTP

												GET /api/v1/checkout/receipt/1234567890 HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
	'thawani-api-key': ""
}

conn.request("GET", "/api/v1/checkout/receipt/1234567890", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/checkout/receipt/1234567890",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/checkout/receipt/1234567890")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Get Single Session Details by Receipt Number Questions & Answers

Get Single Session Details by Reference Number

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/checkout/reference/

GET PRODUCTION

https://checkout.thawani.om/api/v1/checkout/reference/

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
URL Examples
Example Name
Uat: Full Session Information by Reference

https://uatcheckout.thawani.om/api/v1/checkout/reference/[reference-number]

Production: Full Session Information by Reference

https://checkout.thawani.om/api/v1/checkout/reference/[reference-number]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session retrieved successfully"
}

Get Single Session Details by Reference Number

Get Single Session Details by Reference Number Code Example

Code Example

HTTP

												GET /api/v1/checkout/reference/1234567890 HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
	'thawani-api-key': ""
}

conn.request("GET", "/api/v1/checkout/reference/1234567890", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/checkout/reference/1234567890",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/checkout/reference/1234567890")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Get Single Session Details by Reference Number Questions & Answers

Get All Sessions

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/checkout/session/

GET PRODUCTION

https://checkout.thawani.om/api/v1/checkout/session/

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
Limit Yes Numerical

Description: Number of records to be returned in descended order.

Location: URL

Skip Yes Numerical

Description: Number of pages to be skipped. It is used for pagination purposes.

Location: URL

URL Examples
Example Name
Uat: Full Sessions Information Request URL for Production environment

https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1

Production: Full Sessions Information Request URL for Production environment

https://checkout.thawani.om/api/v1/checkout/session?limit=5&skip=1

JSON Examples
Example Name
Respond in JSON format

[
    {
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session retrieved successfully"
}, {
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "option 1": "", "option 2": ""
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 1000
}, {
    "name": "Product B", "quantity": 1, "unit_amount": 2000
}
], "expire_at": "2020-11-12T07:47:38.6693043Z", "cancel_url": "", "created_at": "2020-11-11T07:47:38.7032265Z", "session_id": "", "success_url": "", "total_amount": 3000, "payment_status": "unpaid", "client_reference_id": ""
}, "success": true, "description": "Session retrieved successfully"
}
]

Get All Sessions

Get All Sessions Code Example

Code Example

HTTP

												GET /api/v1/checkout/session?limit=5&skip=1 HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("GET", "/api/v1/checkout/session?limit=5&skip=1", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/checkout/session?limit=5&skip=1",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/checkout/session?limit=5&skip=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Get All Sessions Questions & Answers

About Webhook (Payment Session Result)

Body / Fields
Field Name Required Data Type
success Yes Boolean

Description: Session status if payment was done successfully.

Location: URL

code Yes Numerical

Description: Code of the payment result

Location: URL

description Yes String

Description: Description that explain the payment result

Location: URL

data Yes JSON

Description: set of data that can be used to update the merchant system.

Location: URL

JSON Examples
Example Name
Webhook Sent back Data

{
    "code": 2000, "data": {
    "currency": "OMR", "metadata": {
    "udf1": "value 1", "udf2": "value 2"
}, "products": [
    {
    "name": "Product A", "quantity": 1, "unit_amount": 100
}
], "expire_at": "2020-12-30T20:41:15.914122", "cancel_url": "https://thawani.om", "created_at": "2020-12-29T20:41:15.9156381", "session_id": "checkout_E5IxVqiLaG3fE2Jb7CzHIz5epBx94uBPfaeEOQASDai4TGDwVG", "customer_id": "", "success_url": "https://thawani.om/", "total_amount": 100, "payment_status": "paid", "client_reference_id": "qwer1234"
}, "success": true, "description": "session retrieved successfully"
}

Notes
  • Webhook MUST be created and managed by the merchant. Thawani responsibility is up to sending the result of the session to the defined webhook in the merchant portal.

About Webhook (Payment Session Result)

About Webhook (Payment Session Result) Code Example

About Webhook (Payment Session Result) Questions & Answers

Add Customer

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/customers

GET PRODUCTION

https://checkout.thawani.om/api/v1/customers

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
client_customer_id Yes String

Description: An identification number, email or any variable that can be used by the merchant to identify the customer.

Location: BODY

JSON Examples
Example Name
Request in JSON format

{
    "client_customer_id": "[
    customer-identification
]"
}

Respond in JSON format

{
    "code": 2001, "data": {
    "id": "[
    customer-token-from-thawani
]", "customer_client_id": "[
    customer-identification
]"
}, "success": true, "description": "Customer added successfully"
}

Add Customer

Add Customer Code Example

Code Example

HTTP

												POST /api/v1/customers HTTP/1.1
Thawani-Api-Key: 
Content-Type: application/json
Host: uatcheckout.thawani.om
Content-Length: 52
{
	"client_customer_id": "[email protected]"
}
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/customers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"client_customer_id\": \"[email protected]\"\n}",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/customers",
  "method": "POST",
  "headers": {
    "thawani-api-key": "",
    "Content-Type": "application/json"
  },
  "processData": false,
  "data": "{\n\t\"client_customer_id\": \"[email protected]\"\n}"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/customers")
  .header("thawani-api-key", "")
  .header("Content-Type", "application/json")
  .body("{\n\t\"client_customer_id\": \"[email protected]\"\n}")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = "{\n\t\"client_customer_id\": \"[email protected]\"\n}"

headers = {
    'thawani-api-key': "",
    'Content-Type': "application/json"
}

conn.request("POST", "/api/v1/customers", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/customers");
var request = new RestRequest(Method.POST);
request.AddHeader("thawani-api-key", "");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"client_customer_id\": \"[email protected]\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/customers"

	payload := strings.NewReader("{\n\t\"client_customer_id\": \"[email protected]\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("thawani-api-key", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/customers",
  "headers": {
    "thawani-api-key": "",
    "Content-Type": "application/json",
    "Content-Length": "52"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({client_customer_id: '[email protected]'}));
req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/customers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["thawani-api-key"] = ''
request["Content-Type"] = 'application/json'
request.body = "{\n\t\"client_customer_id\": \"[email protected]\"\n}"

response = http.request(request)
puts response.read_body
											

Add Customer Questions & Answers

Get Customer (Single Customer)

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/customers

GET PRODUCTION

https://checkout.thawani.om/api/v1/customers

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
URL Examples
Example Name
Uat: Full Get Customer Information Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/customers/[client-customer-id]

Production: Full Get Customer Information Request URL (Production)

https://checkout.thawani.om/api/v1/customers/[client-customer-id]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "id": "[
    customer-token-from-thawani
]", "customer_client_id": "[
    customer-identification
]"
}, "success": true, "description": "Customer Retrieved successfully"
}

Get Customer (Single Customer)

Get Customer (Single Customer) Code Example

Code Example

HTTP

												GET /api/v1/customers/cus_yxMN1qCc6VYj HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("GET", "/api/v1/customers/cus_yxMN1qCc6VYj", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/customers/cus_yxMN1qCc6VYj",
  "headers": {
    "cookie": "__cfduid=db2da4f8df385ba1bc43cc3f78cc639da1605328614",
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/customers/cus_yxMN1qCc6VYj")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Get Customer (Single Customer) Questions & Answers

Get All Customer

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/customers

GET PRODUCTION

https://checkout.thawani.om/api/v1/customers

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
Limit Yes Numerical

Description: Number of records to be returned in descended order.

Location: URL

Skip Yes Numerical

Description: Number of pages to be skipped. It is used for pagination purposes.

Location: URL

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": [
    {
    "id": "", "customer_client_id": ""
}, {
    "id": "", "customer_client_id": "[
    <
]customer-identification
]"
}
], "success": true, "description": "Customer Retrieved successfully"
}

Get All Customer

Get All Customer Code Example

Code Example

HTTP

												GET /api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("GET", "/api/v1/customers?skip=1&limit=10", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/customers?skip=1&limit=10",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/customers?skip=1&limit=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["cookie"] = '__cfduid=db2da4f8df385ba1bc43cc3f78cc639da1605328614'
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Get All Customer Questions & Answers

Remove Single Customer

Method
HTTP Method Environment
DEL UAT

https://uatcheckout.thawani.om/api/v1/customers

DEL PRODUCTION

https://uatcheckout.thawani.om/api/v1/customers

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
URL Examples
Example Name
Uat: Remove customer token (UAT)

https://uatcheckout.thawani.om/api/v1/customers/[client-customer-id]

Production: Remove customer token (Production)

https://checkout.thawani.om/api/v1/customers/[client-customer-id]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "success": true, "description": "Customer deleted successfully"
}

Remove Single Customer

Remove Single Customer Code Example

Code Example

HTTP

												DELETE /api/v1/customers/customer_yxMN1qCc6VYj HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj",
  "method": "DELETE",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.delete("https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("DELETE", "/api/v1/customers/customer_yxMN1qCc6VYj", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj");
var request = new RestRequest(Method.DELETE);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "DELETE",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/customers/customer_yxMN1qCc6VYj",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/customers/customer_yxMN1qCc6VYj")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Remove Single Customer Questions & Answers

Customer Payment Method

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/payment_methods

GET PRODUCTION

https://checkout.thawani.om/api/v1/payment_methods

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
customerId Yes String

Description: An identification number, email or any variable that can be used by the merchant to identify the customer.

Location: URL

URL Examples
Example Name
Uat: Get customer payment method (UAT)

https://uatcheckout.thawani.om/api/v1/payment_methods

Production: Get customer payment method (Production)

https://checkout.thawani.om/api/v1/payment_methods

Customer Payment Method

Customer Payment Method Code Example

Code Example

HTTP

												GET /api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI",
  "method": "GET",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("GET", "/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_methods?customerId=cus_qe92dhBJdaLUEWGI")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Customer Payment Method Questions & Answers

Remove Customer Payment Method

Method
HTTP Method Environment
DEL UAT

https://uatcheckout.thawani.om/api/v1/payment_methods

DEL PRODUCTION

https://checkout.thawani.om/api/v1/payment_methods

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
card_token Yes String

Description: A token that been created previously linked with customer.

Location: URL

URL Examples
Example Name
Uat: Remove Customer Payment Method Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/payment_methods/[card_token]

Production: Remove Customer Payment Method Request URL (Production)

https://checkout.thawani.om/api/v1/payment_methods/[card_token]

Remove Customer Payment Method

Remove Customer Payment Method Code Example

Code Example

HTTP

												DELETE /api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly HTTP/1.1
Thawani-Api-Key: 
Host: uatcheckout.thawani.om
											

PHP

												$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_COOKIE => "__cfduid=db2da4f8df385ba1bc43cc3f78cc639da1605328614",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly",
  "method": "DELETE",
  "headers": {
    "thawani-api-key": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.delete("https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly")
  .header("thawani-api-key", "")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': ""
}

conn.request("DELETE", "/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly");
var request = new RestRequest(Method.DELETE);
request.AddHeader("thawani-api-key", "");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("thawani-api-key", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "DELETE",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly",
  "headers": {
    "thawani-api-key": "",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_methods/card_l1WEdODJpxSejzu1Ly")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["cookie"] = '__cfduid=db2da4f8df385ba1bc43cc3f78cc639da1605328614'
request["thawani-api-key"] = ''

response = http.request(request)
puts response.read_body
											

Remove Customer Payment Method Questions & Answers

Get Single Payment Details

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/payments

GET PRODUCTION

https://checkout.thawani.om/api/v1/payments

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
payment_id Yes Numerical

Description: An identification number that presents the payment that has been made against a session.

Location: URL

URL Examples
Example Name
Uat: Get Payment Transaction Details Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/payments/[payment-id]

Production: Get Payment Transaction Details Request URL (Production)

https://checkout.thawani.om/api/v1/payments/[payment-id]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "fee": 0, "last4": "XXXX XXXX XXXX 9018", "amount": 100, "status": "Successful", "refunds": [
    {
    "amount": 100, "reason": "product defect", "status": "successful", "metadata": {
    "user name": "Waddah Al Raisi", "user email": "[email protected]", "user mobile": "99044489"
}, "refund_id": "2021021415502", "created_at": "2021-02-14T11:34:05.1234859"
}
], "activity": "Thawani Cafe", "refunded": true, "card_type": "Debit", "created_at": "2021-02-14T11:27:06.9703028", "payment_id": "2021021415501", "checkout_invoice": "202102141507"
}, "success": true, "description": "Payment retrieved successfully"
}

Get Single Payment Details

Get Single Payment Details Code Example

Code Example

HTTP

												GET /api/v1/payments/20210211329 HTTP/1.1
Thawani-Api-Key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
Host: uatcheckout.thawani.om
											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payments/20210211329",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://uatcheckout.thawani.om/api/v1/payments/20210211329");
xhr.setRequestHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");

xhr.send(data);
											

Java

												iE){J
޲''ij!y(akj_k)?Mmuoay^Zj{*CnrsH[f
׭jĭ)
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
    }

conn.request("GET", "/api/v1/payments/20210211329", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payments/20210211329");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payments/20210211329"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payments/20210211329",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payments/20210211329")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'rRQ26GcsZzoEhbrP2HZvLYDbn9C9et'

response = http.request(request)
puts response.read_body
											

Get Single Payment Details Questions & Answers

Get All Payment Details

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/payments

GET PRODUCTION

https://checkout.thawani.om/api/v1/payments

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
Limit Yes Numerical

Description: Number of records to be returned in descended order.

Location: URL

Skip Yes Numerical

Description: Number of pages to be skipped. It is used for pagination purposes.

Location: URL

URL Examples
Example Name
Uat: Get Payment Transaction Details Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/payments

Production: Get Payment Transaction Details Request URL (Production)

https://checkout.thawani.om/api/v1/payments

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": [
    {
    "fee": 0, "last4": "XXXX XXXX XXXX 4687", "amount": 100, "status": "successful", "refunds": [
    
], "activity": "Thawani Cafe", "refunded": false, "card_type": "Debit", "created_at": "2021-02-15T14:36:29.2818365", "payment_id": "2021021515722", "checkout_invoice": "202102151717"
}, {
    "fee": 0, "last4": "XXXX XXXX XXXX 9018", "amount": 100, "status": "successful", "refunds": [
    {
    "amount": 100, "reason": "product defect", "status": "successful", "metadata": {
    "user name": "Waddah Al Raisi", "user email": "[email protected]", "user mobile": "99044489"
}, "refund_id": "2021021415502", "created_at": "2021-02-14T11:34:05.1234859"
}
], "activity": "Thawani Cafe", "refunded": true, "card_type": "Debit", "created_at": "2021-02-14T11:27:06.9703028", "payment_id": "2021021415501", "checkout_invoice": "202102141507"
}
], "success": true, "description": "Payments retrieved successfully"
}

Get All Payment Details

Get All Payment Details Code Example

Code Example

HTTP

												GET /api/v1/payments?checkout_invoice=&limit=10&skip=1 HTTP/1.1
Thawani-Api-Key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
Host: uatcheckout.thawani.om
											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1",
  "method": "GET",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1")
  .header("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
    }

conn.request("GET", "/api/v1/payments?checkout_invoice=&limit=10&skip=1", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payments?checkout_invoice=&limit=10&skip=1",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payments?checkout_invoice=&limit=10&skip=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'rRQ26GcsZzoEhbrP2HZvLYDbn9C9et'

response = http.request(request)
puts response.read_body
											

Get All Payment Details Questions & Answers

Refund payment

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/refunds

POST PRODUCTION

https://checkout.thawani.om/api/v1/refunds

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
payment_id Yes Numerical

Description: A Number that references the payment. This MUST be provided by the merchant.

Location: BODY

reason Yes String

Description: Values that define the checkout price and what the customer is charged for. It must contain the following data:

  • name: Name of the product
  • unit_amount: selling price per unit
  • quantity: number of units
    • Location: BODY

metadata No JSON

Description: Extra fields that allow to store additional information about the transaction and it is limited to 10 fields only.

Location: BODY

URL Examples
Example Name
Uat: Get Refund Transaction Details Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/refunds

Production: Get Refund Transaction Details Request URL (Production)

https://checkout.thawani.om/api/v1/refunds

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2001, "data": {
    "amount": 100, "reason": "Paid by Mistake", "status": "successful", "metadata": {
    "customer": "Waddah Al Raisi"
}, "refund_id": "2021021715971", "created_at": "2021-02-17T03:11:30.6152965Z", "payment_id": "2021021715970"
}, "success": true, "description": "Refund added successfully"
}

Refund payment

Refund payment Code Example

Code Example

HTTP

												POST /api/v1/refunds HTTP/1.1
Thawani-Api-Key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
Content-Type: application/json
Host: uatcheckout.thawani.om
Content-Length: 115

{
	"payment_id": "2021021715970",
	"reason": "Paid by Mistake",
	"metadata": {
		"customer": "Waddah Al Raisi"
	}
}
											

PHP

												 "https://uatcheckout.thawani.om/api/v1/refunds",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/refunds",
  "method": "POST",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Type": "application/json"
  },
  "processData": false,
  "data": "{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/refunds")
  .header("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")
  .header("Content-Type", "application/json")
  .body("{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = "{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}"

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    'Content-Type': "application/json"
    }

conn.request("POST", "/api/v1/refunds", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/refunds");
var request = new RestRequest(Method.POST);
request.AddHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/refunds"

	payload := strings.NewReader("{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/refunds",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Type": "application/json",
    "Content-Length": "115"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({
  payment_id: '2021021715970',
  reason: 'Paid by Mistake',
  metadata: {customer: 'Waddah Al Raisi'}
}));
req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/refunds")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["thawani-api-key"] = 'rRQ26GcsZzoEhbrP2HZvLYDbn9C9et'
request["Content-Type"] = 'application/json'
request.body = "{\n\t\"payment_id\": \"2021021715970\",\n\t\"reason\": \"Paid by Mistake\",\n\t\"metadata\": {\n\t\t\"customer\": \"Waddah Al Raisi\"\n\t}\n}"

response = http.request(request)
puts response.read_body
											

Refund payment Questions & Answers

Get a Single Refund Transaction Details

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/refunds

GET PRODUCTION

https://checkout.thawani.om/api/v1/refunds

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
refund_id Yes Numerical

Description: An identification number that presents the refund that has been made against a payment.

Location: URL

URL Examples
Example Name
Uat: Get Refund Transaction Details Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/refunds/[refund-id]

Production: Get Refund Transaction Details Request URL (Production)

https://checkout.thawani.om/api/v1/refunds/[refund-id]

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "amount": 100, "reason": "Paid by Mistake", "status": "successful", "metadata": {
    "customer": "Waddah Al Raisi"
}, "refund_id": "2021021715971", "created_at": "2021-02-17T03:11:30.6152965", "payment_id": "2021021715970"
}, "success": true, "description": "Refund retrieved successfully"
}

Get a Single Refund Transaction Details

Get a Single Refund Transaction Details Code Example

Code Example

HTTP

												GET /api/v1/refunds/2021021715971 HTTP/1.1
Thawani-Api-Key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
Host: uatcheckout.thawani.om

											

PHP

												 "https://uatcheckout.thawani.om/api/v1/refunds/2021021715971",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/refunds/2021021715971",
  "method": "GET",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/refunds/2021021715971")
  .header("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
    }

conn.request("GET", "/api/v1/refunds/2021021715971", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/refunds/2021021715971");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/refunds/2021021715971"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/refunds/2021021715971",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
    }

conn.request("GET", "/api/v1/refunds/2021021715971", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

Get a Single Refund Transaction Details Questions & Answers

Get All Refund Transactions Details

Method
HTTP Method Environment
GET UAT

https://uatcheckout.thawani.om/api/v1/refunds

GET PRODUCTION

https://checkout.thawani.om/api/v1/refunds

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
Limit Yes Numerical

Description: Number of records to be returned in descended order.

Location: URL

Skip Yes Numerical

Description: Number of pages to be skipped. It is used for pagination purposes.

Location: URL

URL Examples
Example Name
Uat: Get Refund Transaction Details Request URL (UAT)

https://uatcheckout.thawani.om/api/v1/refunds

Production: Get Refund Transaction Details Request URL (Production)

https://checkout.thawani.om/api/v1/refunds

JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": [
    {
    "amount": 100, "reason": "Paid by Mistake", "status": "successful", "metadata": {
    "customer": "Waddah Al Raisi"
}, "refund_id": "2021021715971", "created_at": "2021-02-17T03:11:30.6152965", "payment_id": "2021021715970"
}, {
    "amount": 100, "reason": "product defect", "status": "successful", "metadata": {
    "user name": "Waddah Al Raisi", "user email": "[email protected]", "user mobile": "99044489"
}, "refund_id": "2021021415502", "created_at": "2021-02-14T11:34:05.1234859", "payment_id": "2021021415501"
}, {
    "amount": 100, "reason": "Testing refund in production", "status": "successful", "metadata": {
    "customer": "Falah Al Lawati"
}, "refund_id": "2021021315414", "created_at": "2021-02-13T20:03:19.5969186", "payment_id": "2021021315413"
}, {
    "amount": 100, "reason": "Testing refund in production", "status": "successful", "metadata": {
    "customer": "Falah Al Lawati"
}, "refund_id": "2021021315410", "created_at": "2021-02-13T19:57:30.0850212", "payment_id": "2021021315409"
}
], "success": true, "description": "Refunds retrieved successfully"
}

Get All Refund Transactions Details

Get All Refund Transactions Details Code Example

Code Example

HTTP

												GET /api/v1/refunds?limit=5&skip=1 HTTP/1.1
Thawani-Api-Key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
Host: uatcheckout.thawani.om

											

PHP

												 "https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1",
  "method": "GET",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1")
  .header("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et"
    }

conn.request("GET", "/api/v1/refunds?limit=5&skip=1", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/refunds?limit=5&skip=1",
  "headers": {
    "thawani-api-key": "rRQ26GcsZzoEhbrP2HZvLYDbn9C9et",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/refunds?limit=5&skip=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'rRQ26GcsZzoEhbrP2HZvLYDbn9C9et'

response = http.request(request)
puts response.read_body
											

Get All Refund Transactions Details Questions & Answers

Create payment intent

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents

POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
Body / Fields
Field Name Required Data Type
client_reference_id Yes String

Description: A string that references to the merchant transaction. This MUST be provided by the merchant.

Location: BODY

return_url Yes URL

Description: Valid URL to redirect the user after intent payment attempt.

Location: BODY

metadata No JSON

Description: Extra fields that allow to store additional information about the transaction and it is limited to 10 fields only.

Location: BODY

payment_method_id No String

Description: payment method id that has already been tokenized.

Location: BODY

amount No Numerical

Description: the amount that the customer will be charged

Location: URL

JSON Examples
Example Name
Request in JSON format

{
    "amount": 100, "metadata": {
    "customer": "here is your customer name"
}, "return_url": "https://thw.om/success", "payment_method_id": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}

Respond in JSON format

{
    "code": 2001, "data": {
    "id": "pi_CAeoe1BR7j2hgA0zmMoD", "amount": 100, "status": "requires_confirmation", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-17T03:45:37.0843032Z", "created_at": "2021-03-16T03:45:37.0844914Z", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, "success": true, "description": "Payment intent added successfully"
}

Create payment intent

Create payment intent Code Example

Code Example

HTTP

												POST /api/v1/payment_intents HTTP/1.1
Content-Type: application/json
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om
Content-Length: 213

{
	"payment_method_id": "card_0ZnzVPUQpm0USeian1h8ty2zuG",
	"amount": 100,
	"client_reference_id": "1234567",
	"return_url": "https://thw.om/success",
	"metadata": {
		"customer": "here is your customer name"
	}
}
											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  },
  "processData": false,
  "data": "{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/payment_intents")
  .header("Content-Type", "application/json")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .body("{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = "{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}"

headers = {
    'Content-Type': "application/json",
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("POST", "/api/v1/payment_intents", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
request.AddParameter("application/json", "{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents"

	payload := strings.NewReader("{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "213"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({
  payment_method_id: 'card_0ZnzVPUQpm0USeian1h8ty2zuG',
  amount: 100,
  client_reference_id: '1234567',
  return_url: 'https://thw.om/success',
  metadata: {customer: 'here is your customer name'}
}));
req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'
request.body = "{\n\t\"payment_method_id\": \"card_0ZnzVPUQpm0USeian1h8ty2zuG\",\n\t\"amount\": 100,\n\t\"client_reference_id\": \"1234567\",\n\t\"return_url\": \"https://thw.om/success\",\n\t\"metadata\": {\n\t\t\"customer\": \"here is your customer name\"\n\t}\n}"

response = http.request(request)
puts response.read_body
											

Create payment intent Questions & Answers

Confirm payment intent

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]/confirm

POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]/confirm

Header Parameters
Parameter Description
thawani-api-key Secret key that obtainable from the merchant portal
Content-type Application/json
JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "id": "pi_OH4A3ZhhnqBRK6hc5oLj", "amount": 100, "status": "requires_action", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-19T03:23:37.4527891", "created_at": "2021-03-18T03:23:37.4529793", "next_action": {
    "url": "https://uatcheckout.thawani.om/api/v1/pay/authorize/fidVZHxoYGtxTGtxYGtxTGEnPyd1bFpKTTFENl9tbWt0R1dOM21mMGpJbycpJ0ZpbGBrcVZgZndgcSc%2FJ3VsWkpNMUQ2X21ta3RHV04zbWYwaklvWnZgZndgcVptc1JPTDddMzVzT0NdRlFKU2BKNTU9Rid4", "return_url": "https://thw.om/success"
}, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, "success": true, "description": "Payment intent retrieved successfully"
}

Confirm payment intent

Confirm payment intent Code Example

Code Example

HTTP

												POST /api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm HTTP/1.1
Content-Type: application/json
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om


											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  },
  "processData": false,
  "data": ""
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm")
  .header("Content-Type", "application/json")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'Content-Type': "application/json",
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("POST", "/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/confirm")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'

response = http.request(request)
puts response.read_body
											

Confirm payment intent Questions & Answers

Cancel payment intent

Method
HTTP Method Environment
POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]/cancel

POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]/cancel

Header Parameters
Parameter Description
Content-type Application/json
thawani-api-key Secret key that obtainable from the merchant portal
JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "id": "pi_OH4A3ZhhnqBRK6hc5oLj", "amount": 100, "status": "cancelled", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-19T03:23:37.4527891", "created_at": "2021-03-18T03:23:37.4529793", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, "success": true, "description": "Payment intent retrieved successfully"
}

Cancel payment intent

Cancel payment intent Code Example

Code Example

HTTP

												POST /api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel HTTP/1.1
Content-Type: application/json
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om


											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  },
  "processData": false,
  "data": ""
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.post("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel")
  .header("Content-Type", "application/json")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'Content-Type': "application/json",
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("POST", "/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "POST",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel",
  "headers": {
    "Content-Type": "application/json",
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_OH4A3ZhhnqBRK6hc5oLj/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'

response = http.request(request)
puts response.read_body
											

Cancel payment intent Questions & Answers

Get payment intent

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]

POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents/[your-payment-intent-id]

Header Parameters
Parameter Description
Content-type Application/json
JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "id": "pi_umtpwTuUw3BNDjErEwzd", "amount": 100, "status": "requires_confirmation", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-19T03:24:41.3434211", "created_at": "2021-03-18T03:24:41.343423", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, "success": true, "description": "Payment intent retrieved successfully"
}

Get payment intent

Get payment intent Code Example

Code Example

HTTP

												GET /api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd HTTP/1.1
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om


											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd",
  "method": "GET",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("GET", "/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents/pi_umtpwTuUw3BNDjErEwzd")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'

response = http.request(request)
puts response.read_body
											

Get payment intent Questions & Answers

Get payment intent by reference

Method
HTTP Method Environment
POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents/[your-payment-reference]/reference

POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents/[your-payment-reference]/reference

Header Parameters
Parameter Description
Content-type Application/json
JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": {
    "id": "pi_93PU3D7YMHnkZAkjt7Ya", "amount": 100, "status": "succeeded", "currency": "OMR", "metadata": {
    "customer": "Falah Al Lawati"
}, "expire_at": "2021-03-16T22:01:06.1275058", "created_at": "2021-03-15T22:01:06.1276993", "next_action": null, "payment_method": "card_BK8p16ybaNWwKSifu1fx7YwNE4", "client_reference_id": "1234567"
}, "success": true, "description": "Payment intent retrieved successfully"
}

Get payment intent by reference

Get payment intent by reference Code Example

Code Example

HTTP

												GET /api/v1/payment_intents/1234567/reference HTTP/1.1
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om


											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference",
  "method": "GET",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("GET", "/api/v1/payment_intents/1234567/reference", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents/1234567/reference",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents/1234567/reference")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'

response = http.request(request)
puts response.read_body
											

Get payment intent by reference Questions & Answers

Get payment intents

Method
HTTP Method Environment
POST PRODUCTION

https://checkout.thawani.om/api/v1/payment_intents

POST UAT

https://uatcheckout.thawani.om/api/v1/payment_intents

Header Parameters
Parameter Description
Content-type Application/json
JSON Examples
Example Name
Respond in JSON format

{
    "code": 2000, "data": [
    {
    "id": "pi_umtpwTuUw3BNDjErEwzd", "amount": 100, "status": "requires_confirmation", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-19T03:24:41.3434211", "created_at": "2021-03-18T03:24:41.343423", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, {
    "id": "pi_OH4A3ZhhnqBRK6hc5oLj", "amount": 100, "status": "cancelled", "currency": "OMR", "metadata": {
    "customer": "here is your customer name"
}, "expire_at": "2021-03-19T03:23:37.4527891", "created_at": "2021-03-18T03:23:37.4529793", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, {
    "id": "pi_qWbpjV36m5czhPuhLmTh", "amount": 100, "status": "succeeded", "currency": "OMR", "metadata": {
    "customer": "Waddah Al Raisi"
}, "expire_at": "2021-03-17T13:46:50.7021522", "created_at": "2021-03-16T13:46:50.702178", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, {
    "id": "pi_CAeoe1BR7j2hgA0zmMoD", "amount": 100, "status": "succeeded", "currency": "OMR", "metadata": {
    "customer": "Waddah Al Raisi"
}, "expire_at": "2021-03-17T03:45:37.0843032", "created_at": "2021-03-16T03:45:37.0844914", "next_action": null, "payment_method": "card_0ZnzVPUQpm0USeian1h8ty2zuG", "client_reference_id": "1234567"
}, {
    "id": "pi_93PU3D7YMHnkZAkjt7Ya", "amount": 100, "status": "succeeded", "currency": "OMR", "metadata": {
    "customer": "Falah Al Lawati"
}, "expire_at": "2021-03-16T22:01:06.1275058", "created_at": "2021-03-15T22:01:06.1276993", "next_action": null, "payment_method": "card_BK8p16ybaNWwKSifu1fx7YwNE4", "client_reference_id": "1234567"
}
], "success": true, "description": "sessions retrieved successfully"
}

Get payment intents

Get payment intents Code Example

Code Example

HTTP

												GET /api/v1/payment_intents?limit=10&skip=1 HTTP/1.1
Thawani-Api-Key: xVkVbea3UFQscdHueHHGCXGUXeUjYj
Host: uatcheckout.thawani.om


											

PHP

												 "https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "thawani-api-key: xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
											

JavaScript

												const settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1",
  "method": "GET",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
											

Java

												HttpResponse response = Unirest.get("https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1")
  .header("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")
  .asString();
											

Python

												import http.client

conn = http.client.HTTPSConnection("uatcheckout.thawani.om")

payload = ""

headers = {
    'thawani-api-key': "xVkVbea3UFQscdHueHHGCXGUXeUjYj"
    }

conn.request("GET", "/api/v1/payment_intents?limit=10&skip=1", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
											

C#

												var client = new RestClient("https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1");
var request = new RestRequest(Method.GET);
request.AddHeader("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj");
IRestResponse response = client.Execute(request);
											

GO

												package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("thawani-api-key", "xVkVbea3UFQscdHueHHGCXGUXeUjYj")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
											

Node.JS

												const http = require("https");

const options = {
  "method": "GET",
  "hostname": "uatcheckout.thawani.om",
  "port": null,
  "path": "/api/v1/payment_intents?limit=10&skip=1",
  "headers": {
    "thawani-api-key": "xVkVbea3UFQscdHueHHGCXGUXeUjYj",
    "Content-Length": "0"
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
											

Ruby

												require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://uatcheckout.thawani.om/api/v1/payment_intents?limit=10&skip=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["thawani-api-key"] = 'xVkVbea3UFQscdHueHHGCXGUXeUjYj'

response = http.request(request)
puts response.read_body
											

Get payment intents Questions & Answers

Need some support? We got you covered

Need some support? We got you covered

Need some support? We got you covered Code Example

Need some support? We got you covered Questions & Answers

Success Card

Success Card

Images

Success Card

Success Card

Success Card Code Example

Success Card Questions & Answers

Decline Card

Decline Card

Images

Decline Card

Decline Card

Decline Card Code Example

Decline Card Questions & Answers