TQDR API Documentation
v-1.0 beta
TQDR Payment
TQDR Payment Integration is a 3rd party service without any use of banking information using only prepaid TQDR receipts, making it secure and easy to integrate. There are only three simple steps required for integration:
How to integrate?
1
Payment Preparation
Send the request with required attributes to get the payment id.
2
TQDR Widget Showing
Show the TQDR payment widget by using the id from first step which include the payment information.
3
Payment Status Getting
Check the payment status if it is successful by using the payment id which you got from the first step.
1- Payment Preparation
https://developers.tqdr.com.sa/api/v1/checkouts
TQDR request payment process is divided into three steps as simply as a request to the
TQDR server with the necessary parameters and getting the response.
An API key is a token that you provide when making TQDR API calls and you can take it from contract with TQDR.
Include the token in request body called API Key
.
Post the necessary fields for TQDR API to send new payment order after formatting as a json
.
You can get store
unique identity from the contract with TQDR or from your dashboard within TQDR.
amount
must be less than 5000 SAR for one payment proccess.
If you want to know more refer TQDR API attributes.
curl --request POST \
--url https://developers.tqdr.com.sa/api/v1/checkouts \
--header 'Content-Type: application/json' \
--data '{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}'
echo '{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}' | \
http POST https://developers.tqdr.com.sa/api/v1/checkouts \
Content-Type:application/json
wget --quiet \
--method POST \
--header 'Content-Type: application/json' \
--body-data '{\n "apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",\n "store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",\n "amount": 99.9\n}' \
--output-document \
- https://developers.tqdr.com.sa/api/v1/checkouts
fetch("https://developers.tqdr.com.sa/api/v1/checkouts", {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"apikey\":\"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\"store\":\"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\"amount\":99.9}"
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});
const data = JSON.stringify({
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://developers.tqdr.com.sa/api/v1/checkouts");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
const settings = {
"async": true,
"crossDomain": true,
"url": "https://developers.tqdr.com.sa/api/v1/checkouts",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"processData": false,
"data": "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"
};
$.ajax(settings).done(function (response) {
console.log(response);
});
import axios from "axios";
const options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts',
headers: {'Content-Type': 'application/json'},
data: {apikey: 'Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA', store: 'Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0', amount: 99.9}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
const http = require("https");
const options = {
"method": "POST",
"hostname": "developers.tqdr.com.sa",
"port": null,
"path": "/api/v1/checkouts",
"headers": {
"Content-Type": "application/json"
}
};
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({apikey: 'Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA', store: 'Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0', amount: 99.9}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts',
headers: {'Content-Type': 'application/json'},
body: {apikey: 'Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA', store: 'Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0', amount: 99.9},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require("unirest");
const req = unirest("POST", "https://developers.tqdr.com.sa/api/v1/checkouts");
req.headers({
"Content-Type": "application/json"
});
req.type("json");
req.send({
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const fetch = require('node-fetch');
let url = 'https://developers.tqdr.com.sa/api/v1/checkouts';
let options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: '{"apikey":"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA","store":"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0","amount":99.9}'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts',
headers: {'Content-Type': 'application/json'},
data: {apikey: 'Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA', store: 'Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0', amount: 99.9}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import http.client
conn = http.client.HTTPSConnection("developers.tqdr.com.sa")
payload = "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"
headers = { 'Content-Type': "application/json" }
conn.request("POST", "/api/v1/checkouts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "https://developers.tqdr.com.sa/api/v1/checkouts"
payload = "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"
headers = {'Content-Type': 'application/json'}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://developers.tqdr.com.sa/api/v1/checkouts"
payload := strings.NewReader("{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://developers.tqdr.com.sa/api/v1/checkouts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}");
CURLcode ret = curl_easy_perform(hnd);
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json" };
NSDictionary *parameters = @{ @"apikey": @"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
@"store": @"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
@"amount": @99.9 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://developers.tqdr.com.sa/api/v1/checkouts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://developers.tqdr.com.sa/api/v1/checkouts" in
let headers = Header.add (Header.init ()) "Content-Type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://developers.tqdr.com.sa/api/v1/checkouts"),
Headers =
{
{ "Content-Type", "application/json" },
},
Content = new StringContent("{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": 123,\n \"amount\": 99.9\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("https://developers.tqdr.com.sa/api/v1/checkouts");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://developers.tqdr.com.sa/api/v1/checkouts")
.setHeader("Content-Type", "application/json")
.setBody("{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://developers.tqdr.com.sa/api/v1/checkouts"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}");
Request request = new Request.Builder()
.url("https://developers.tqdr.com.sa/api/v1/checkouts")
.post(body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.post("https://developers.tqdr.com.sa/api/v1/checkouts")
.header("Content-Type", "application/json")
.body("{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}")
.asString();
POST /api/v1/checkouts HTTP/1.1
Content-Type: application/json
Host: developers.tqdr.com.sa
Content-Length: 58
{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}
(require '[clj-http.client :as client])
(client/post "https://developers.tqdr.com.sa/api/v1/checkouts" {:headers {:Content-Type "application/json"}
:content-type :json
:form-params {:apikey "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA"
:store "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0"
:amount 99.9}})
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}")
val request = Request.Builder()
.url("https://developers.tqdr.com.sa/api/v1/checkouts")
.post(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()
<?php
$request = new HttpRequest();
$request->setUrl('https://developers.tqdr.com.sa/api/v1/checkouts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'Content-Type' => 'application/json'
]);
$request->setBody('{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}');
$request->setRequestUrl('https://developers.tqdr.com.sa/api/v1/checkouts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'Content-Type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
?>
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://developers.tqdr.com.sa/api/v1/checkouts",
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 \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://developers.tqdr.com.sa/api/v1/checkouts' -Method POST -Headers $headers -ContentType 'undefined' -Body '{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}'
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-RestMethod -Uri 'https://developers.tqdr.com.sa/api/v1/checkouts' -Method POST -Headers $headers -ContentType 'undefined' -Body '{
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
}'
library(httr)
url <- "https://developers.tqdr.com.sa/api/v1/checkouts"
payload <- "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers(Content_Type = 'application/json'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://developers.tqdr.com.sa/api/v1/checkouts")
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.body = "{\n \"apikey\": \"Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA\",\n \"store\": \"Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0\",\n \"amount\": 99.9\n}"
response = http.request(request)
puts response.read_body
import Foundation
let headers = ["Content-Type": "application/json"]
let parameters = [
"apikey": "Aa3B!0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdHF234HFhhgft2340uc2FcL2FwaVwvbG9naW4iLCJpYXQiOjE2Mzc3Njhg@@%kjh765sImV4cCI6MTYzNzc2OTA4OCwibmJmIjoxNjM3NzY3Mjg4LCJqdGkiOiJ6azRLYnJ3T0FRTUdicnNPIiwic3ViIjoxMiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.jrj22YPlVZKR6l04IkzgX67ZuaQN50GGiLCeUtwzxsA",
"store": "Aaw46mlI6Odr2Drfc89#ewhO3eAwp81v0xEOAAkrhjLolBG^hc98KiH7mSwhh3@3V&DXnDUUlbsfjhRF7%lnfz8R^wZIauEmtE0",
"amount": 99.9
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://developers.tqdr.com.sa/api/v1/checkouts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
2- TQDR Widget Showing
You can embed TQDR payment widget simply by copying the HTML\JavaScript
and pasting it into your target with changing the widget id
you take
from the first step.
You can copy and paste the following code into your target to get TQDR payment tool HTML/JavaScript.
<script src="https://developers.tqdr.com.sa/v1/tqdrPaymentWidget.js"></script>
The resultUrl
,
which is the page on your site where the customer should be redirected to after the payment is processed.
The data-id
value you take from the first step. If you want to customize the widget refer
TQDR Widget Customization
<form id="paymentWidgetTQDR" action="{resultUrl}"
data-id=""></form>
3- Payment Status
https://developers.tqdr.com.sa/api/v1/checkouts//paymentstatus
TQDR API calls must be as POST
https method. If you want to inquire about the payment status you need
just change the payment id
in the the url which you got from step one. If you want to know all of the
responses just refer the TQDR Response Codes.
curl --request POST \
--url https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus \
--header 'Content-Type: application/json' \
--data ''
echo '' | \
http POST https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus \
Content-Type:application/json
wget --quiet \
--method POST \
--header 'Content-Type: application/json' \
--body-data '' \
--output-document \
- https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus
fetch("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus", {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": ""
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});
const data = "";
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
const settings = {
"async": true,
"crossDomain": true,
"url": "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"data": ""
};
$.ajax(settings).done(function (response) {
console.log(response);
});
import axios from "axios";
const options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus',
headers: {'Content-Type': 'application/json'},
data: ''
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
const http = require("https");
const options = {
"method": "POST",
"hostname": "developers.tqdr.com.sa",
"port": null,
"path": "/api/v1/checkouts/id/paymentstatus",
"headers": {
"Content-Type": "application/json"
}
};
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("");
req.end();
const request = require('request');
const options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus',
headers: {'Content-Type': 'application/json'},
body: ''
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require("unirest");
const req = unirest("POST", "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus");
req.headers({
"Content-Type": "application/json"
});
req.send("");
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const fetch = require('node-fetch');
let url = 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus';
let options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: ''
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus',
headers: {'Content-Type': 'application/json'},
data: ''
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import http.client
conn = http.client.HTTPSConnection("developers.tqdr.com.sa")
payload = ""
headers = { 'Content-Type': "application/json" }
conn.request("POST", "/api/v1/checkouts/id/paymentstatus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"
payload = ""
headers = {'Content-Type': 'application/json'}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"
payload := strings.NewReader("")
req, _ := http.NewRequest("POST", url, payload)
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))
}
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "");
CURLcode ret = curl_easy_perform(hnd);
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json" };
NSData *postData = [[NSData alloc] initWithData:[@"{}" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus" in
let headers = Header.add (Header.init ()) "Content-Type" "application/json" in
let body = Cohttp_lwt_body.of_string "" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"),
Headers =
{
{ "Content-Type", "application/json" },
},
Content = new StringContent("")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("text/plain")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")
.setHeader("Content-Type", "application/json")
.setBody("")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")
.post(body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.post("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")
.header("Content-Type", "application/json")
.body("")
.asString();
POST /api/v1/checkouts/id/payment HTTP/1.1
Content-Type: application/json
Host: developers.tqdr.com.sa
Content-Length: 129
{}
(require '[clj-http.client :as client])
(client/post "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus" {:headers {:Content-Type "application/json"}
:body "{}"})
val client = OkHttpClient()
val mediaType = MediaType.parse("text/plain")
val body = RequestBody.create(mediaType, "")
val request = Request.Builder()
.url("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")
.post(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()
<?php
$request = new HttpRequest();
$request->setUrl('https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'Content-Type' => 'application/json'
]);
$request->setBody('');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('');
$request->setRequestUrl('https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'Content-Type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
?>
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus",
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"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus' -Method POST -Headers $headers -ContentType 'undefined' -Body ''
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-RestMethod -Uri 'https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus' -Method POST -Headers $headers -ContentType 'undefined' -Body ''
library(httr)
url <- "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus"
payload <- ""
encode <- "raw"
response <- VERB("POST", url, body = payload, add_headers(Content_Type = 'application/json'), content_type("text/plain"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")
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.body = ""
response = http.request(request)
puts response.read_body
import Foundation
let headers = ["Content-Type": "application/json"]
let postData = NSData(data: "".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://developers.tqdr.com.sa/api/v1/checkouts/id/paymentstatus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()