【发布时间】:2021-09-24 17:19:02
【问题描述】:
我正在尝试在 coinbase 商务中创建费用
const query = {
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',
};
const opts = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CC-Api-Key': '6225fe4d-f9a8-498f-8085-11dea4212316',
'X-CC-Version': '2018-03-22',
},
body: JSON.stringify({ query }),
};
const res = fetch('https://api.commerce.coinbase.com/charges', opts).then(
(res) => res.json()
);
这是我当前的发帖请求,但它显示错误,我认为是格式问题,但有人可以帮助我吗?
【问题讨论】:
标签: javascript http-post coinbase-api