Create a refund
curl --request POST \
--url https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 50,
"note": "<string>",
"metadata": {
"order_id": "1042"
},
"allow_payout": true
}
'import requests
url = "https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds"
payload = {
"amount": 50,
"note": "<string>",
"metadata": { "order_id": "1042" },
"allow_payout": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 50, note: '<string>', metadata: {order_id: '1042'}, allow_payout: true})
};
fetch('https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds', 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://api.orqex.com/v1/payment/intents/{paymentIntentId}/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 => json_encode([
'amount' => 50,
'note' => '<string>',
'metadata' => [
'order_id' => '1042'
],
'allow_payout' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds"
payload := strings.NewReader("{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": "ref_8Lm3Vp",
"amount": {
"value": 50,
"formatted": "$50.00",
"short": "$50",
"currency": "USD"
},
"reason": {
"value": "<string>",
"label": "<string>"
},
"note": "<string>",
"failure_code": "<string>",
"failure_message": "<string>",
"metadata": {},
"payout": {
"id": "<string>",
"gateway_code": "<string>",
"method": "<string>",
"recipient": {
"id": "pin_5Yt2Wc",
"phone_number": "<string>",
"account_name": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"swift_bic": "<string>",
"country": {
"code": "US",
"name": "United States",
"flag": "<string>"
},
"address": "<string>",
"network": "<string>",
"memo_tag": "<string>"
},
"gateway_transaction_id": "<string>",
"fee_amount": 123,
"status": "<string>",
"initiated_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
},
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "The given data was invalid.",
"errors": {}
}{
"message": "<string>"
}Refunds
Create a refund
Refunds all or part of a completed payment. Check the intent’s refunds_summary.refundable_amount first.
POST
/
payment
/
intents
/
{paymentIntentId}
/
refunds
Create a refund
curl --request POST \
--url https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 50,
"note": "<string>",
"metadata": {
"order_id": "1042"
},
"allow_payout": true
}
'import requests
url = "https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds"
payload = {
"amount": 50,
"note": "<string>",
"metadata": { "order_id": "1042" },
"allow_payout": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 50, note: '<string>', metadata: {order_id: '1042'}, allow_payout: true})
};
fetch('https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds', 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://api.orqex.com/v1/payment/intents/{paymentIntentId}/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 => json_encode([
'amount' => 50,
'note' => '<string>',
'metadata' => [
'order_id' => '1042'
],
'allow_payout' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds"
payload := strings.NewReader("{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orqex.com/v1/payment/intents/{paymentIntentId}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50,\n \"note\": \"<string>\",\n \"metadata\": {\n \"order_id\": \"1042\"\n },\n \"allow_payout\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": "ref_8Lm3Vp",
"amount": {
"value": 50,
"formatted": "$50.00",
"short": "$50",
"currency": "USD"
},
"reason": {
"value": "<string>",
"label": "<string>"
},
"note": "<string>",
"failure_code": "<string>",
"failure_message": "<string>",
"metadata": {},
"payout": {
"id": "<string>",
"gateway_code": "<string>",
"method": "<string>",
"recipient": {
"id": "pin_5Yt2Wc",
"phone_number": "<string>",
"account_name": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"swift_bic": "<string>",
"country": {
"code": "US",
"name": "United States",
"flag": "<string>"
},
"address": "<string>",
"network": "<string>",
"memo_tag": "<string>"
},
"gateway_transaction_id": "<string>",
"fee_amount": 123,
"status": "<string>",
"initiated_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
},
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "The given data was invalid.",
"errors": {}
}{
"message": "<string>"
}Authorizations
Your secret key, e.g. sk_live_... or sk_sandbox_....
Headers
Optional key, 8 to 128 characters, that makes this request safe to retry. The first response is stored for 24 hours; a repeat returns it unchanged with X-Idempotent-Replayed: true.
Required string length:
8 - 128Path Parameters
The payment intent id.
Body
application/json
Amount in major units, at most the intent's refunds_summary.refundable_amount.
Required range:
x >= 1Example:
50
Available options:
requested_by_customer, duplicate, fraudulent, product_not_received, product_unsatisfactory, order_cancelled, other Maximum string length:
500Up to 10 key/value pairs of your own, returned unchanged.
Example:
{ "order_id": "1042" }
Allow the refund to go out as a payout to the original payer. Requires the corresponding project setting.
Was this page helpful?
⌘I