curl --request POST \
--url https://payments.coinbase.com/api/v1/payments/{paymentId}/void \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"metadata": {},
"deallocateRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
]
}
'import requests
url = "https://payments.coinbase.com/api/v1/payments/{paymentId}/void"
payload = {
"metadata": {},
"deallocateRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
]
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
metadata: {},
deallocateRewards: [{campaignAddress: '<string>', tokenAddress: '<string>', chainId: 123}]
})
};
fetch('https://payments.coinbase.com/api/v1/payments/{paymentId}/void', 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://payments.coinbase.com/api/v1/payments/{paymentId}/void",
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([
'metadata' => [
],
'deallocateRewards' => [
[
'campaignAddress' => '<string>',
'tokenAddress' => '<string>',
'chainId' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-idempotency-key: <x-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://payments.coinbase.com/api/v1/payments/{paymentId}/void"
payload := strings.NewReader("{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("Authorization", "<api-key>")
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://payments.coinbase.com/api/v1/payments/{paymentId}/void")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/payments/{paymentId}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"operationId": "<string>",
"rewardOperations": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"reward": {
"id": "<string>",
"campaignAddress": "<string>",
"paymentInfoHash": "<string>",
"recipientAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"amount": "<string>",
"transactionHash": "<string>",
"error": "<string>",
"errorCode": "<string>",
"revertReason": "<string>",
"blockNumber": "<string>",
"metadata": {},
"operationSteps": [
{
"entity": "<string>",
"id": "<string>",
"operationId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"params": {},
"error": "<string>",
"errorCode": "<string>",
"transactions": [
{
"entity": "<string>",
"transactionHash": "<string>",
"blockNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"revertReason": "<string>",
"operationStepId": "<string>"
}
]
}
]
}
],
"invalidRewardInputs": [
{
"rewardInput": {
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
},
"invalidReason": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Void payment
Void a payment using the payment ID. This simplified endpoint fetches payment details from the database.
curl --request POST \
--url https://payments.coinbase.com/api/v1/payments/{paymentId}/void \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"metadata": {},
"deallocateRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
]
}
'import requests
url = "https://payments.coinbase.com/api/v1/payments/{paymentId}/void"
payload = {
"metadata": {},
"deallocateRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
]
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
metadata: {},
deallocateRewards: [{campaignAddress: '<string>', tokenAddress: '<string>', chainId: 123}]
})
};
fetch('https://payments.coinbase.com/api/v1/payments/{paymentId}/void', 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://payments.coinbase.com/api/v1/payments/{paymentId}/void",
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([
'metadata' => [
],
'deallocateRewards' => [
[
'campaignAddress' => '<string>',
'tokenAddress' => '<string>',
'chainId' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-idempotency-key: <x-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://payments.coinbase.com/api/v1/payments/{paymentId}/void"
payload := strings.NewReader("{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("Authorization", "<api-key>")
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://payments.coinbase.com/api/v1/payments/{paymentId}/void")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/payments/{paymentId}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {},\n \"deallocateRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"operationId": "<string>",
"rewardOperations": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"reward": {
"id": "<string>",
"campaignAddress": "<string>",
"paymentInfoHash": "<string>",
"recipientAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"amount": "<string>",
"transactionHash": "<string>",
"error": "<string>",
"errorCode": "<string>",
"revertReason": "<string>",
"blockNumber": "<string>",
"metadata": {},
"operationSteps": [
{
"entity": "<string>",
"id": "<string>",
"operationId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"params": {},
"error": "<string>",
"errorCode": "<string>",
"transactions": [
{
"entity": "<string>",
"transactionHash": "<string>",
"blockNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"revertReason": "<string>",
"operationStepId": "<string>"
}
]
}
]
}
],
"invalidRewardInputs": [
{
"rewardInput": {
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
},
"invalidReason": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
Authorization header using the Bearer scheme. Learn more about JWT tokens in the Coinbase Developer Portal.
Headers
Unique identifier to ensure request idempotency
Path Parameters
The unique identifier of the payment to void.
Body
Request payload for voiding a payment using the payment ID. This simplified endpoint fetches payment details from the database.
Metadata for the payment operation that will be returned in the webhook.
{ "key": "value" }
List of rewards to deallocate during payment void.
Show child attributes
Show child attributes
[ { "campaignAddress": "0x1234567890123456789012345678901234567890", "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "chainId": 8453 } ]
Response
A successful response.
Response payload for payment void requests.
Identifier for the payment operation.
"op-2341434"
List of reward operations with detailed information, if rewards were processed.
Show child attributes
Show child attributes
[ { "id": "ro-5678901", "reward": { "id": "rw-123456", "campaignAddress": "0x1234567890123456789012345678901234567890", "paymentInfoHash": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef", "recipientAddress": "0x8078EB517712aAAdcCE9a0C5Ec04dC2DC5Ef8793", "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "chainId": 8453, "createdAt": "2024-03-20T00:00:00.000Z", "updatedAt": "2024-03-20T00:30:00.000Z" }, "action": "REWARD_OPERATION_ACTION_ALLOCATE", "amount": "100.00", "status": "REWARD_OPERATION_STATUS_PENDING", "transactionHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "createdAt": "2024-03-20T00:00:00.000Z", "updatedAt": "2024-03-20T00:30:00.000Z", "metadata": { "key": "value" } } ]
List of rewards that were invalid/unable to be processed with detailed reasoning
Show child attributes
Show child attributes
[ { "rewardInput": { "campaignAddress": "0x1234567890123456789012345678901234567890", "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "chainId": 8453 }, "invalidReason": "invalid campaign address" } ]
Was this page helpful?