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",
"chain": "ETH",
"addressTag": "123456789"
},
"amount": {},
"toAmount": {
"amount": "3.14"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69"
}
'import requests
url = "https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload = {
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"chain": "ETH",
"addressTag": "123456789"
},
"amount": {},
"toAmount": { "amount": "3.14" },
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69"
}
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',
chain: 'ETH',
addressTag: '123456789'
},
amount: {},
toAmount: {amount: '3.14'},
paymentId: '2e7b6557-1967-4348-ad81-daf3cee4c175',
customerExternalRef: '310c458a-18eb-4cbd-8a9a-586d9448ae69'
})
};
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',
'chain' => 'ETH',
'addressTag' => '123456789'
],
'amount' => [
],
'toAmount' => [
'amount' => '3.14'
],
'paymentId' => '2e7b6557-1967-4348-ad81-daf3cee4c175',
'customerExternalRef' => '310c458a-18eb-4cbd-8a9a-586d9448ae69'
]),
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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b8627ae8-732b-4d25-b947-1df8f4007a29",
"type": "payment",
"merchantId": "fc988ed5-c129-4f70-a064-e5beb7eb8e32",
"amount": {
"currency": "USD",
"amount": "3.14"
},
"status": "pending",
"merchantWalletId": "1000662322",
"statusReason": "compliance_review",
"errorCode": "insufficient_funds",
"fees": {
"amount": "3.14",
"currency": "USD"
},
"networkFees": {
"amount": "3.14",
"currency": "USD",
"feePayer": "endUser"
},
"paymentIntentId": "6e4d4047-db14-4c09-b238-1215aee50d03",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69",
"settlementAmount": {
"amount": "3.14",
"currency": "USD"
},
"fromAddresses": {
"chain": "ETH",
"addresses": [
"0x8381470ED67C3802402dbbFa0058E8871F017A6F"
]
},
"depositAddress": {
"chain": "ETH",
"address": "0x97de855690955e0da79ce5c1b6804847e7070c7f",
"addressTag": "123456789"
},
"transactionHash": "0x7351585460bd657f320b9afa02a52c26d89272d0d10cc29913eb8b28e64fd906",
"refundIds": [
"8edc0da8-d086-3051-a393-53f972d16444"
],
"paymentId": "36a25933-8c2d-3c23-ad07-7fe1e41b5fe5",
"createDate": "2020-04-10T02:13:30.000Z",
"updateDate": "2020-04-10T02:13:30.000Z",
"riskEvaluation": {
"decision": "approved",
"reason": "3000"
}
}
}{
"code": 2,
"message": "API parameter invalid."
}{
"code": 4,
"message": "Unauthorized."
}{
"code": 404,
"message": "Not found."
}{
"code": -1,
"message": "Something went wrong. errId: 1f0b0c455e40f753f07b4f0ae6abd4b4"
}Refund a payment intent
Creates a crypto refund for a payment intent.
Digital Asset Accounts: crypto payments are available only for custody accounts (purpose: custody) and are for third-party payments only. They are not supported when the distributor or the end user is under the Circle FR (CIRCLE_FR) or Circle SG (CIRCLE_SG) legal entity.
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",
"chain": "ETH",
"addressTag": "123456789"
},
"amount": {},
"toAmount": {
"amount": "3.14"
},
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69"
}
'import requests
url = "https://api-sandbox.circle.com/v1/paymentIntents/{id}/refund"
payload = {
"idempotencyKey": "ba943ff1-ca16-49b2-ba55-1057e70ca5c7",
"destination": {
"address": "0x8381470ED67C3802402dbbFa0058E8871F017A6F",
"chain": "ETH",
"addressTag": "123456789"
},
"amount": {},
"toAmount": { "amount": "3.14" },
"paymentId": "2e7b6557-1967-4348-ad81-daf3cee4c175",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69"
}
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',
chain: 'ETH',
addressTag: '123456789'
},
amount: {},
toAmount: {amount: '3.14'},
paymentId: '2e7b6557-1967-4348-ad81-daf3cee4c175',
customerExternalRef: '310c458a-18eb-4cbd-8a9a-586d9448ae69'
})
};
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',
'chain' => 'ETH',
'addressTag' => '123456789'
],
'amount' => [
],
'toAmount' => [
'amount' => '3.14'
],
'paymentId' => '2e7b6557-1967-4348-ad81-daf3cee4c175',
'customerExternalRef' => '310c458a-18eb-4cbd-8a9a-586d9448ae69'
]),
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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\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 \"chain\": \"ETH\",\n \"addressTag\": \"123456789\"\n },\n \"amount\": {},\n \"toAmount\": {\n \"amount\": \"3.14\"\n },\n \"paymentId\": \"2e7b6557-1967-4348-ad81-daf3cee4c175\",\n \"customerExternalRef\": \"310c458a-18eb-4cbd-8a9a-586d9448ae69\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b8627ae8-732b-4d25-b947-1df8f4007a29",
"type": "payment",
"merchantId": "fc988ed5-c129-4f70-a064-e5beb7eb8e32",
"amount": {
"currency": "USD",
"amount": "3.14"
},
"status": "pending",
"merchantWalletId": "1000662322",
"statusReason": "compliance_review",
"errorCode": "insufficient_funds",
"fees": {
"amount": "3.14",
"currency": "USD"
},
"networkFees": {
"amount": "3.14",
"currency": "USD",
"feePayer": "endUser"
},
"paymentIntentId": "6e4d4047-db14-4c09-b238-1215aee50d03",
"customerExternalRef": "310c458a-18eb-4cbd-8a9a-586d9448ae69",
"settlementAmount": {
"amount": "3.14",
"currency": "USD"
},
"fromAddresses": {
"chain": "ETH",
"addresses": [
"0x8381470ED67C3802402dbbFa0058E8871F017A6F"
]
},
"depositAddress": {
"chain": "ETH",
"address": "0x97de855690955e0da79ce5c1b6804847e7070c7f",
"addressTag": "123456789"
},
"transactionHash": "0x7351585460bd657f320b9afa02a52c26d89272d0d10cc29913eb8b28e64fd906",
"refundIds": [
"8edc0da8-d086-3051-a393-53f972d16444"
],
"paymentId": "36a25933-8c2d-3c23-ad07-7fe1e41b5fe5",
"createDate": "2020-04-10T02:13:30.000Z",
"updateDate": "2020-04-10T02:13:30.000Z",
"riskEvaluation": {
"decision": "approved",
"reason": "3000"
}
}
}{
"code": 2,
"message": "API parameter invalid."
}{
"code": 4,
"message": "Unauthorized."
}{
"code": 404,
"message": "Not found."
}{
"code": -1,
"message": "Something went wrong. errId: 1f0b0c455e40f753f07b4f0ae6abd4b4"
}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 blockchain address to send a crypto refund to.
Show child attributes
Show child attributes
The source amount of the refund. The currency must be the payment intent currency or its settlement currency.
Show child attributes
Show child attributes
The destination amount of the refund. The currency must be the payment intent currency.
Show child attributes
Show child attributes
ID of the payment to attribute this refund to.
"2e7b6557-1967-4348-ad81-daf3cee4c175"
Optional customer-supplied reference for this refund. Unlike payins, it is not inherited from the payment intent and is not part of the idempotency key, so a replay with the same idempotencyKey but a changed value returns the original refund.
"310c458a-18eb-4cbd-8a9a-586d9448ae69"
Response
Crypto refund successfully created for the given payment intent.
A crypto payment or crypto refund.
Show child attributes
Show child attributes
Was this page helpful?