curl --request POST \
--url https://api.quidkey.com/v1/transactions/{id}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": {
"value": 4503599627370496,
"currency": "<string>"
},
"reason": "<string>"
}
'import requests
url = "https://api.quidkey.com/v1/transactions/{id}/refunds"
payload = {
"amount": {
"value": 4503599627370496,
"currency": "<string>"
},
"reason": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: {value: 4503599627370496, currency: '<string>'}, reason: '<string>'})
};
fetch('https://api.quidkey.com/v1/transactions/{id}/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.quidkey.com/v1/transactions/{id}/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' => [
'value' => 4503599627370496,
'currency' => '<string>'
],
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.quidkey.com/v1/transactions/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.quidkey.com/v1/transactions/{id}/refunds")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quidkey.com/v1/transactions/{id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"_type": "transaction",
"_uri": "<string>",
"_view": "full",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "payment",
"is_test": true,
"transaction_number": "<string>",
"status": "pending",
"reason": "<string>",
"failure": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"required_actions": [
{
"code": "<string>",
"message": "<string>",
"actor": "api",
"target": {
"_link": "<string>",
"_type": "<string>",
"id": "<string>"
},
"fields": [
"<string>"
],
"hosted_link": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}
],
"amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"payout_amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"exchange_rate": {
"rate": "<string>",
"from_currency": "<string>",
"to_currency": "<string>"
},
"fees": {
"total": {
"value": 4503599627370495,
"currency": "<string>"
},
"items": [
{
"type": "percentage",
"amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"tax_amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"rate": "<string>",
"status": "pending",
"settled_at": "2023-11-07T05:31:56Z"
}
]
},
"routing": "virtual_account",
"refund_status": "refunding",
"can_refund": true,
"order": {
"order_id": "<string>"
},
"rewards": {
"extra_rewards": "<string>",
"total_rewards": "<string>",
"description": "<string>"
},
"reported_statement_descriptor": "<string>",
"platform": "api",
"merchant": {
"_link": "<string>",
"_type": "merchant",
"id": "<string>"
},
"customer_details": {
"_link": "<string>",
"_type": "customer_details",
"id": "<string>"
},
"parent_transaction": {
"_link": "<string>",
"_type": "transaction",
"id": "<string>"
},
"refunds": {
"_link": "<string>",
"_type": "collection"
},
"reversals": [
{
"_link": "<string>",
"_type": "transaction",
"id": "<string>"
}
],
"payout": {
"_link": "<string>",
"_type": "payout",
"id": "<string>"
},
"checkout": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
},
"entities": {},
"not_included": [
{
"link": {
"_link": "<string>",
"_type": "<string>",
"id": "<string>"
},
"reason": "no_permission"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}Create a refund
Creates a refund of the payment transaction with this ID, one at a time per payment transaction. The caller chooses whether money moves through execution, and there’s no default. A payment transaction whose customer hasn’t acted yet answers 409 TRANSACTION_NOT_REFUNDABLE. PAYMENT_BUSY means another request is working on this payment transaction. After that or a 503, send the same request again with the same key. Poll GET /transactions/{refund_id} to follow it, since no webhook covers refunds today. A held or blocked refund that shouldn’t go ahead is cancelled by Quidkey support.
Credentials: partner, merchant
Permission: refunds:create
curl --request POST \
--url https://api.quidkey.com/v1/transactions/{id}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount": {
"value": 4503599627370496,
"currency": "<string>"
},
"reason": "<string>"
}
'import requests
url = "https://api.quidkey.com/v1/transactions/{id}/refunds"
payload = {
"amount": {
"value": 4503599627370496,
"currency": "<string>"
},
"reason": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: {value: 4503599627370496, currency: '<string>'}, reason: '<string>'})
};
fetch('https://api.quidkey.com/v1/transactions/{id}/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.quidkey.com/v1/transactions/{id}/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' => [
'value' => 4503599627370496,
'currency' => '<string>'
],
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.quidkey.com/v1/transactions/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.quidkey.com/v1/transactions/{id}/refunds")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quidkey.com/v1/transactions/{id}/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": {\n \"value\": 4503599627370496,\n \"currency\": \"<string>\"\n },\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"_type": "transaction",
"_uri": "<string>",
"_view": "full",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "payment",
"is_test": true,
"transaction_number": "<string>",
"status": "pending",
"reason": "<string>",
"failure": {
"code": "<string>",
"message": "<string>",
"retryable": true
},
"required_actions": [
{
"code": "<string>",
"message": "<string>",
"actor": "api",
"target": {
"_link": "<string>",
"_type": "<string>",
"id": "<string>"
},
"fields": [
"<string>"
],
"hosted_link": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}
],
"amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"payout_amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"exchange_rate": {
"rate": "<string>",
"from_currency": "<string>",
"to_currency": "<string>"
},
"fees": {
"total": {
"value": 4503599627370495,
"currency": "<string>"
},
"items": [
{
"type": "percentage",
"amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"tax_amount": {
"value": 4503599627370495,
"currency": "<string>"
},
"rate": "<string>",
"status": "pending",
"settled_at": "2023-11-07T05:31:56Z"
}
]
},
"routing": "virtual_account",
"refund_status": "refunding",
"can_refund": true,
"order": {
"order_id": "<string>"
},
"rewards": {
"extra_rewards": "<string>",
"total_rewards": "<string>",
"description": "<string>"
},
"reported_statement_descriptor": "<string>",
"platform": "api",
"merchant": {
"_link": "<string>",
"_type": "merchant",
"id": "<string>"
},
"customer_details": {
"_link": "<string>",
"_type": "customer_details",
"id": "<string>"
},
"parent_transaction": {
"_link": "<string>",
"_type": "transaction",
"id": "<string>"
},
"refunds": {
"_link": "<string>",
"_type": "collection"
},
"reversals": [
{
"_link": "<string>",
"_type": "transaction",
"id": "<string>"
}
],
"payout": {
"_link": "<string>",
"_type": "payout",
"id": "<string>"
},
"checkout": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
},
"entities": {},
"not_included": [
{
"link": {
"_link": "<string>",
"_type": "<string>",
"id": "<string>"
},
"reason": "no_permission"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>"
}
],
"retryable": true,
"request_id": "<string>"
}
}Authorizations
Headers
1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.
1 - 257^(?:([\x21\x23-\x5B\x5D-\x7E]{1,255})|"([\x21\x23-\x5B\x5D-\x7E]{1,255})")$Body
Whether the refund moves money by itself. There is no default.
automatic: Quidkey moves the money as soon as it can, with no further call.manual: The refund is held until:executeRefund, and a held refund blocks further refunds of that payment transaction until it is executed, or cancelled by Quidkey support.
automatic, manual