While setting up a site to use a Coinbase payment button, I'm trying to figure out where in coinbase API v2 Order notifications the 'custom' field shows up. In API v1, it was in notification['orders'][0..n]['order']['custom']
, but I can't find where it is in API v2. Help!
The name of the field is now 'metadata
.
Here's an example order notification:
{
"id": "b84f7aba-487f-5487-9885-b69953d8d077",
"type": "wallet:orders:paid",
"data": {
"resource": {
"metadata": {
"meta": "data",
"dat": "a meta"
},...
Whereas v1 allows you to add a single custom parameter, v2 will allow you to include key value pairs as outlined in the v2 Metadata documentation.
Edit to address the comment:
In v1, the custom
parameter could be included in the URL parameters for a given button, which meant the same button could be reused, as long as the name, price, description, etc., didn't change.
In v2, the metadata
parameter must be included in the body of the checkout request. This means that in order to attach unique metadata to an order, a unique checkout (button) will need to be created for each potential customer.