curl --request POST \
--url https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"addressTag": "123456789",
"addressBookId": "e7f468c7-6a99-5639-b3ed-8c7d477abb47"
},
"amount": {},
"toAmount": {
"amount": "3.14"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
}
'import requests
url = "https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload = {
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"addressTag": "123456789",
"addressBookId": "e7f468c7-6a99-5639-b3ed-8c7d477abb47"
},
"amount": {},
"toAmount": { "amount": "3.14" },
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
}
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({
idempotencyKey: 'ba943ff1-ca16-49b2-ba55-1057e70ca5c7',
destination: {
address: '0x8381470ED67C3802402dbbFa0058E8871F017A6F',
addressTag: '123456789',
addressBookId: 'e7f468c7-6a99-5639-b3ed-8c7d477abb47'
},
amount: {},
toAmount: {amount: '3.14'},
paymentId: '2e7b6557-1967-4348-ad81-daf3cee4c175'
})
};
fetch('https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund', 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-sandbox.circle.com/v1/paymentIntents/{id}/refund",
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([
'idempotencyKey' => 'ba943ff1-ca16-49b2-ba55-1057e70ca5c7',
'destination' => [
'address' => '0x8381470ED67C3802402dbbFa0058E8871F017A6F',
'addressTag' => '123456789',
'addressBookId' => 'e7f468c7-6a99-5639-b3ed-8c7d477abb47'
],
'amount' => [
],
'toAmount' => [
'amount' => '3.14'
],
'paymentId' => '2e7b6557-1967-4348-ad81-daf3cee4c175'
]),
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-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload := strings.NewReader("{\n \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\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-sandbox.circle.com/v1/paymentIntents/{id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund")
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 \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3389f4ba-aafd-4eef-aaa2-3292df8f62e6",
"type": "refund",
"status": "pending",
"amount": {
"currency": "USD"
},
"merchantId": "5ffea093-d210-44b4-a7ca-ad33b9498188",
"merchantWalletId": "1000999922",
"paymentIntentId": "77c91fe9-e603-4e7b-9672-1ef8ac502cf6",
"settlementAmount": {
"amount": "1.00",
"currency": "ETH"
},
"fromAddresses": {
"chain": "ETH",
"addresses": [
"0x0d4344cFF68F72A5B9Abded37CA5862941a62050"
]
},
"depositAddress": {
"chain": "ETH",
"address": "0x97de855690955e0da79ce5c1b6804847e7070c7f"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"createDate": "2022-07-21T20:16:35.092852Z",
"updateDate": "2022-07-21T20:19:24.719313Z"
}
}{
"code": 400,
"message": "Bad request."
}{
"code": 401,
"message": "Malformed authorization."
}{
"code": 404,
"message": "Not found."
}Refund a payment intent
curl --request POST \
--url https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"addressTag": "123456789",
"addressBookId": "e7f468c7-6a99-5639-b3ed-8c7d477abb47"
},
"amount": {},
"toAmount": {
"amount": "3.14"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
}
'import requests
url = "https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload = {
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"addressTag": "123456789",
"addressBookId": "e7f468c7-6a99-5639-b3ed-8c7d477abb47"
},
"amount": {},
"toAmount": { "amount": "3.14" },
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175"
}
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({
idempotencyKey: 'ba943ff1-ca16-49b2-ba55-1057e70ca5c7',
destination: {
address: '0x8381470ED67C3802402dbbFa0058E8871F017A6F',
addressTag: '123456789',
addressBookId: 'e7f468c7-6a99-5639-b3ed-8c7d477abb47'
},
amount: {},
toAmount: {amount: '3.14'},
paymentId: '2e7b6557-1967-4348-ad81-daf3cee4c175'
})
};
fetch('https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund', 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-sandbox.circle.com/v1/paymentIntents/{id}/refund",
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([
'idempotencyKey' => 'ba943ff1-ca16-49b2-ba55-1057e70ca5c7',
'destination' => [
'address' => '0x8381470ED67C3802402dbbFa0058E8871F017A6F',
'addressTag' => '123456789',
'addressBookId' => 'e7f468c7-6a99-5639-b3ed-8c7d477abb47'
],
'amount' => [
],
'toAmount' => [
'amount' => '3.14'
],
'paymentId' => '2e7b6557-1967-4348-ad81-daf3cee4c175'
]),
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-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload := strings.NewReader("{\n \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\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-sandbox.circle.com/v1/paymentIntents/{id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund")
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 \"idempotencyKey\": \"ba943ff1-ca16-49b2-ba55-1057e70ca5c7\",\n \"destination\": {\n \"address\": \"0x8381470ED67C3802402dbbFa0058E8871F017A6F\",\n \"addressTag\": \"123456789\",\n \"addressBookId\": \"e7f468c7-6a99-5639-b3ed-8c7d477abb47\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3389f4ba-aafd-4eef-aaa2-3292df8f62e6",
"type": "refund",
"status": "pending",
"amount": {
"currency": "USD"
},
"merchantId": "5ffea093-d210-44b4-a7ca-ad33b9498188",
"merchantWalletId": "1000999922",
"paymentIntentId": "77c91fe9-e603-4e7b-9672-1ef8ac502cf6",
"settlementAmount": {
"amount": "1.00",
"currency": "ETH"
},
"fromAddresses": {
"chain": "ETH",
"addresses": [
"0x0d4344cFF68F72A5B9Abded37CA5862941a62050"
]
},
"depositAddress": {
"chain": "ETH",
"address": "0x97de855690955e0da79ce5c1b6804847e7070c7f"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"createDate": "2022-07-21T20:16:35.092852Z",
"updateDate": "2022-07-21T20:19:24.719313Z"
}
}{
"code": 400,
"message": "Bad request."
}{
"code": 401,
"message": "Malformed authorization."
}{
"code": 404,
"message": "Not found."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Universally unique identifier (UUID v4) of a resource.
"b3d9d2d5-4c12-4946-a09d-953e82fae2b0"
Body
Universally unique identifier (UUID v4) idempotency key. This key is utilized to ensure exactly-once execution of mutating requests.
"ba943ff1-ca16-49b2-ba55-1057e70ca5c7"
The destination of a crypto refund.
For merchants registered under Circle's Singapore legal entity, addressBookId is required and the destination must reference an address registered in the Address Book under a hosted VASP, to comply with the Singapore Travel Rule. For other legal entities, provide address and chain.
Show child attributes
Show child attributes
The source amount of the refund, it can be in either the original payment currency or the settlement currency.
Show child attributes
Show child attributes
The destination amount of the refund, it must be in the original payment currency.
Show child attributes
Show child attributes
Optional ID of the payment to attribute this refund to. When provided, the refund is associated with the specified payment under the payment intent.
"2e7b6557-1967-4348-ad81-daf3cee4c175"
Response
Crypto refund successfully created for the given payment intent.
Status information of the related payment.
Show child attributes
Show child attributes
Was this page helpful?