Make Refund
curl --request POST \
--url https://dashu.sa/api/external/makeRefund \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"data": {
"Suppliers": [
{}
]
},
"test": true
}
'import requests
url = "https://dashu.sa/api/external/makeRefund"
payload = {
"apiKey": "<string>",
"data": { "Suppliers": [{}] },
"test": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({apiKey: '<string>', data: {Suppliers: [{}]}, test: true})
};
fetch('https://dashu.sa/api/external/makeRefund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dashu.sa/api/external/makeRefund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '<string>',
'data' => [
'Suppliers' => [
[
]
]
],
'test' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dashu.sa/api/external/makeRefund"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dashu.sa/api/external/makeRefund")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dashu.sa/api/external/makeRefund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}"
response = http.request(request)
puts response.read_body{
"IsSuccess": true,
"Message": "Refund Created Successfully!",
"ValidationErrors": null,
"Data": {
"Key": "3445302",
"RefundId": 86815,
"RefundReference": "2024000022",
"RefundInvoiceId": 3449413,
"Amount": 1,
"Comment": "partial refund to the customer"
}
}
{
"success": false,
"code": 5,
"message": "`Suppliers` is not valid."
}
General Endpoints
Make Refund
Using this endpoint you’ll have the ability to make a refund full/partial for a specific invoice or payment.
POST
/
makeRefund
Make Refund
curl --request POST \
--url https://dashu.sa/api/external/makeRefund \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"data": {
"Suppliers": [
{}
]
},
"test": true
}
'import requests
url = "https://dashu.sa/api/external/makeRefund"
payload = {
"apiKey": "<string>",
"data": { "Suppliers": [{}] },
"test": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({apiKey: '<string>', data: {Suppliers: [{}]}, test: true})
};
fetch('https://dashu.sa/api/external/makeRefund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dashu.sa/api/external/makeRefund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '<string>',
'data' => [
'Suppliers' => [
[
]
]
],
'test' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dashu.sa/api/external/makeRefund"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dashu.sa/api/external/makeRefund")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dashu.sa/api/external/makeRefund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"<string>\",\n \"data\": {\n \"Suppliers\": [\n {}\n ]\n },\n \"test\": true\n}"
response = http.request(request)
puts response.read_body{
"IsSuccess": true,
"Message": "Refund Created Successfully!",
"ValidationErrors": null,
"Data": {
"Key": "3445302",
"RefundId": 86815,
"RefundReference": "2024000022",
"RefundInvoiceId": 3449413,
"Amount": 1,
"Comment": "partial refund to the customer"
}
}
{
"success": false,
"code": 5,
"message": "`Suppliers` is not valid."
}
Query Parameters
string
required
The API Key of your account.
object
required
Hide properties
Hide properties
boolean
Set this property to
true to send the request to the development
environment.{
"IsSuccess": true,
"Message": "Refund Created Successfully!",
"ValidationErrors": null,
"Data": {
"Key": "3445302",
"RefundId": 86815,
"RefundReference": "2024000022",
"RefundInvoiceId": 3449413,
"Amount": 1,
"Comment": "partial refund to the customer"
}
}
{
"success": false,
"code": 5,
"message": "`Suppliers` is not valid."
}
Response properties
boolean
required
The response status.
string
required
The description of the response status.
array|null
required
List of validation errors (if any).
object
required
Hide properties
Hide properties
string
required
The key value you have passed for the Request Transaction.
integer
required
A unique number indicates the Refund request in DashPay system.
string
required
The refund reference generated by DashPay for following up with the finance team.
string
required
The InvoiceId of the refunded amount.
string
required
The amount to be refunded.
string
required
The comments that you have passed in the request.
Error Codes
Here’s a list of possible error codes of this endpoint.| Code | Description |
|---|---|
| 1 | Missing or invalid api key |
| 2 | Key is a required parameter. |
| 3 | KeyType is a required parameter. |
| 4 | Key is invalid. |
| 5 | Suppliers is not valid. |
| 6 | wrong supplier code. |
| 7 | An error meessage from the bank. |
⌘I