coinbase / coinbase-commerce-node

Coinbase Commerce Node
MIT License
148 stars 54 forks source link

Curl request Documentation issue #28

Closed gabkk closed 4 years ago

gabkk commented 4 years ago

Hi I know it's probably not the right place to post this issue but i didn't find any other place

From your documentation page: https://commerce.coinbase.com/docs/api/#charges

You are missing one backslash, and there is one comma which shouldn't be there

curl https://api.commerce.coinbase.com/charges \ -X POST \ -H 'Content-Type: application/json' \ -H "X-CC-Api-Key: " \ -H "X-CC-Version: 2018-03-22" -d '{ "name": "The Sovereign Individual", "description": "Mastering the Transition to the Information Age", "local_price": { "amount": "100.00", "currency": "USD" }, "pricing_type": "fixed_price", "metadata": { "customer_id": "id_1005", "customer_name": "Satoshi Nakamoto" }, "redirect_url": "https://charge/completed/page", "cancel_url": "https://charge/canceled/page", }'

We get an error: {"error":{"type":"invalid_request","message":"Malformed parameters"}}

The correct request is

curl https://api.commerce.coinbase.com/charges \ -X POST \ -H 'Content-Type: application/json' \ -H "X-CC-Api-Key: " \ -H "X-CC-Version: 2018-03-22" \ -d '{ "name": "The Sovereign Individual", "description": "Mastering the Transition to the Information Age", "local_price": { "amount": "100.00", "currency": "USD" }, "pricing_type": "fixed_price", "metadata": { "customer_id": "id_1005", "customer_name": "Satoshi Nakamoto" }, "redirect_url": "https://charge/completed/page", "cancel_url": "https://charge/canceled/page" }'

The response is correct

{"data":{"addresses":{"bitcoincash" ....

oa-coinbase commented 4 years ago

Thanks for the mention @gabkk this fix will be going in today.