Withdrawal-Send
Withdrawal - Send Withdrawal Request
This API is used to withdraw money from sadad account The withdraw request will be created and amount will be deducted from sadad account If request is successful then details will be provided in response
Withdrawal request status description
- IN PROGRESS
- REJECTED
- REQUESTED
- ON HOLD
- APPROVED
- CANCELLED
- POST
Sandbox
https://api-sandbox.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest
Live
https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest
Permission: Merchant
- Curl
- Ruby
- Python
- PHP
- Java
- Node.js
- Go
- .NET
curl -d '{"sadadId": 9288463, "message": "some text", "amount": 150}' -H "Content-Type: application/json" -H "Authorization: {ACCESS_TOKEN}" -X POST https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest
require 'net/http'
require 'json'
uri = URI("https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "{ACCESS_TOKEN}"
request.body = {
sadadId: 9288463,
message: "some text",
amount: 150
}.to_json
response = http.request(request)
puts response.body
import requests
url = "https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest"
headers = {
"Content-Type": "application/json",
"Authorization": "{ACCESS_TOKEN}"
}
payload = {
"sadadId": 9288463,
"message": "some text",
"amount": 150
}
response = requests.post(url, headers=headers, json=payload)
print(response.text)
<?php
$url = "https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest";
$data = [
"sadadId" => 9288463,
"message" => "some text",
"amount" => 150
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: {ACCESS_TOKEN}"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class SendWithdrawalRequest {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "{ACCESS_TOKEN}");
conn.setDoOutput(true);
String jsonInput = "{\"sadadId\":9288463,\"message\":\"some text\",\"amount\":150}";
OutputStream os = conn.getOutputStream();
os.write(jsonInput.getBytes());
os.flush();
os.close();
System.out.println(conn.getResponseCode());
}
}
fetch("https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "{ACCESS_TOKEN}"
},
body: JSON.stringify({
sadadId: 9288463,
message: "some text",
amount: 150
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
package main
import (
"bytes"
"fmt"
"net/http"
)
func main() {
jsonStr := []byte(`{
"sadadId":9288463,
"message":"some text",
"amount":150
}`)
req, _ := http.NewRequest("POST",
"https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest",
bytes.NewBuffer(jsonStr))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "{ACCESS_TOKEN}")
client := &http.Client{}
resp, _ := client.Do(req)
fmt.Println(resp.Status)
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "{ACCESS_TOKEN}");
var json = @"{
""sadadId"": 9288463,
""message"": ""some text"",
""amount"": 150
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://api-s.sadad.qa/api/withdrawalrequests/sendWithdrawalRequest",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Header
| Field | Type | Description |
|---|---|---|
| Authorization | String | User's unique access-token. |
- Header-Example:
{
"Authorization": "BN79o6YNrY4IPP60UF4JmNEM6O8hX9HVUq0e0HWNyo2tt1jqCT9IWnXSBhfr7Mws"
}
Parameter
| Field | Type | Description |
|---|---|---|
| sadadId | Number | The Merchant's SadadId. |
| message ( optional) | String | The message for withdrawal. |
| amount | Number | The amount to be withdraw. |
- Request-Example:
{
"sadadId": 9288463,
"message": "some text",
"amount": 150
}
Success 200
| Field | Type | Description |
|---|---|---|
| amount | Number | Withdrawned amount. |
| message | String | Withdrawal message. |
| withdrawnumber | String | Withdrawal number |
| withdrawalrequeststatusId | Number | Status Id of request. |
| generatedby | String | By whom this request is generated. |
| id | Number | Id of request data. |
| date | String | Date of request. |
| withdrawalrequeststatus | Object | Description of status. |
- Success-Response:
{
"amount": 10,
"message": "Withdraw request test",
"withdrawnumber": "SD8XXXXXXXXXXX9",
"withdrawalrequeststatusId": 3,
"generatedby": "user",
"id": 6395,
"date": "2021-01-29",
"withdrawalrequeststatus": {
"name": "REQUESTED",
"id": 3
}
}
Error 4xx
| Field | Description |
|---|---|
| 401 | Authorization Required |
| 400 | Please provide data |
| 404 | User's verified bank details not found! |
- Response (example):
{
"error": {
"statusCode": 401,
"name": "Error",
"message": "Authorization Required"
}
}