I’m looking for field descriptions in the API reference guide, for instance on the Create a charge page Create a charge | Coinbase Cloud. I see a list of fields, but I can’t find the descriptions. I’m looking for the following:
General description of the field and its purpose
Maximum length (and what happens in case your string has a longer length, will it give an error or will it be truncated)
Optional or required
Possible values (like ‘fixed_price’ in the pricing_type field)
Thank you for your interest in Coinbase Commerce API.
We understand that you want to know the description and possible values of BODY PARAMS such as pricing_type, currency, etc when using Create a Charge endpoint. For a detailed description for the possible values of each parameter of Create a Charge endpoint, we have enumerated our responses below.
“name”[Optional]
For the***“name”*** parameter, you can indicate the name of the charge that you want to create.
Example request: "name":"Human Fund"
“description”[Optional]
For the “description” parameter, you can indicate the description of the charge you want to create.
Example request: "description":"Money for People"
“pricing_type”[Required]
The pricing type parameter indicates what type of charge you want to create. We have two types of values for the pricing_type object.
no_price
This pricing type lets the receiver initiate the amount they want to pay in cryptocurrency.
Example request: "pricing_type":"no_price"
fixed_price
This pricing type lets you indicate the amount of cryptocurrency you want to receive from your customer.
Example request: "pricing_type":"fixed_price"
“local_price”[Required]
For the “local_price” object, it lets you indicate the “amount” and “currency” of the charge you want to create.
For the value of “currency” parameter, you can indicate the currency of the charge you want to create. Coinbase Commerce currently supports ApeCoin(APE), Bitcoin(BTC), Bitcoin Cash(BCH), DAI(DAI), Dogecoin(DOGE), Ethereum(ETH), Litecoin(LTC), SHIBA INU(SHIB), Tether(USDT) and USD Coin(USD). Also, we also support MATIC(MATIC), USD Coin(USDC), and Wrapped Ether (ETH) on Polygon.
Example Request: "local_price": { "amount":"20", "currency": "USD" },
“metadata”[Optional]
The metadata parameter lets you indicate your customer information such as "customer_id" and “customer_name”.
Example Request: "metadata": { "customer_id": "CB_Commerce", "customer_name": "Coinbase Commerce" }
“redirect_url”[Optional]
Once payments become successful it will be redirected to the stated website in this parameter
Example Request: "redirect_url":"https://beta.commerce.coinbase.com/payment-succesful"
“cancel_url”[Optional]
Once payments were cancelled it will be redirected to the stated website in this parameter
Example Request: "cancel_url":"https://beta.commerce.coinbase.com/cancelled-payments"
With regard to your statement “Maximum length (and what happens in case your string has a longer length, will it give an error or will it be truncated).” Can you please provide more explanation on this? This would give us a better understanding of your concern.
Once you send us the information requested above, we’ll work to quickly address your concern.
About the maximum length of the strings. For example, let’s say the maximum value for the name field is 34 characters, what happens if I enter a string longer than 34 characters? Will it give an error? Or will it shorten the string to 34 characters, and cut off the end part?
And the main question being, what are the maximum length values of the fields?
Thank you for reaching back to us. We are glad that we’ve clarified your concern. Regarding your questions about the maximum characters of the fields, you may see each fields below with their corresponding maximum characters:
name - has 100 maximum characters
description - has 200 maximum characters
pricing_type - this field is excluded as it only has 2 values: no_price and fixed_price
local_price - each parameter in this object has different maximum characters
amount - local price amount must be less than or equal to 9999999999999999999999999
currency - this field is also excluded as local price currency must be a valid currency ISO code only
metadata - the fields under this object are unlike other fields because there is no specific maximum characters. However, values on these parameters must be at most 2048 serialized types
customer_id
customer_name
redirect_url - has 3000 maximum characters
cancel_url - has 3000 maximum characters
For your question about what will happen if you enter longer than the stated maximum characters, calling the Create a Charge endpoint will result in error depending on which field has exceeded the maximum characters limit.
We hope this answers your questions. Thank you and have a great day!
Perfect! That answers all my questions. Thank you so much for the extensive answers! It would be great if these details could be incorporated into the guide.
We’re happy to help. Thank you for sharing your insights. We are pleased to inform you that Coinbase is working on updating the documentation and we’ve logged this as feedback and have our internal teams look into this. While Coinbase can’t provide a specific timeline, rest assured that we are constantly working to build products our customers will love.