curl --request POST \
--url https://payments.coinbase.com/api/v1/payments/{paymentId}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"amount": "<string>",
"feeBps": 123,
"feeReceiver": "<string>",
"distributeRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
],
"metadata": {}
}
'import requests
url = "https://payments.coinbase.com/api/v1/payments/{paymentId}/capture"
payload = {
"amount": "<string>",
"feeBps": 123,
"feeReceiver": "<string>",
"distributeRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
],
"metadata": {}
}
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({
amount: '<string>',
feeBps: 123,
feeReceiver: '<string>',
distributeRewards: [{campaignAddress: '<string>', tokenAddress: '<string>', chainId: 123}],
metadata: {}
})
};
fetch('https://payments.coinbase.com/api/v1/payments/{paymentId}/capture', 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}/capture",
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' => '<string>',
'feeBps' => 123,
'feeReceiver' => '<string>',
'distributeRewards' => [
[
'campaignAddress' => '<string>',
'tokenAddress' => '<string>',
'chainId' => 123
]
],
'metadata' => [
]
]),
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}/capture"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\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}/capture")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/payments/{paymentId}/capture")
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 \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\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>"
}
]
}Capture payment
Capture funds from the authorized 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}/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"amount": "<string>",
"feeBps": 123,
"feeReceiver": "<string>",
"distributeRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
],
"metadata": {}
}
'import requests
url = "https://payments.coinbase.com/api/v1/payments/{paymentId}/capture"
payload = {
"amount": "<string>",
"feeBps": 123,
"feeReceiver": "<string>",
"distributeRewards": [
{
"campaignAddress": "<string>",
"tokenAddress": "<string>",
"chainId": 123
}
],
"metadata": {}
}
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({
amount: '<string>',
feeBps: 123,
feeReceiver: '<string>',
distributeRewards: [{campaignAddress: '<string>', tokenAddress: '<string>', chainId: 123}],
metadata: {}
})
};
fetch('https://payments.coinbase.com/api/v1/payments/{paymentId}/capture', 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}/capture",
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' => '<string>',
'feeBps' => 123,
'feeReceiver' => '<string>',
'distributeRewards' => [
[
'campaignAddress' => '<string>',
'tokenAddress' => '<string>',
'chainId' => 123
]
],
'metadata' => [
]
]),
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}/capture"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\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}/capture")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/payments/{paymentId}/capture")
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 \"amount\": \"<string>\",\n \"feeBps\": 123,\n \"feeReceiver\": \"<string>\",\n \"distributeRewards\": [\n {\n \"campaignAddress\": \"<string>\",\n \"tokenAddress\": \"<string>\",\n \"chainId\": 123\n }\n ],\n \"metadata\": {}\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 capture.
Body
Request payload for capturing a payment using the payment ID. This simplified endpoint fetches payment details from the database.
Amount to capture in the escrow protocol.
"50.00"
Fee in basis points.
"50"
Address of the fee receiver.
"0x8078EB517712aAAdcCE9a0C5Ec04dC2DC5Ef8793"
List of rewards to distribute during payment capture.
Show child attributes
Show child attributes
[ { "campaignAddress": "0x1234567890123456789012345678901234567890", "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "chainId": 8453 } ]
Metadata for the payment operation that will be returned in the webhook.
{ "key": "value" }
Response
A successful response.
Response payload for payment capture 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?