我想使用 coinbase commerce API ( https://commerce.coinbase.com/docs/api/ )接受比特币支付
我使用 curl 创建了一个付款地址,如下所示。
$curl = curl_init();
$postFilds=array(
'name' => 'Test Name',
'description' => 'Testing for checkout api',
'pricing_type' => 'fixed_price',
'local_price' => [
'amount' => '100.00',
'currency' => 'USD'
],
'requested_info' => ['Test', 'test@gmail.com'],
'metadata' => ['userId'=>10]
);
$postFilds=urldecode(http_build_query($postFilds));
curl_setopt_array($curl,
array(
CURLOPT_URL => "https://api.commerce.coinbase.com/charges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $postFilds,
CURLOPT_HTTPHEADER => array(
"X-CC-Api-Key: api_key",
"X-CC-Version: 2018-03-22",
"content-type: multipart/form-data"
),
)
);
$response = curl_exec($curl);
现在我想使用 curl 或 PHP 检查付款状态是否失败或成功
我不知道如何使用 webhook。我的网站在 laravel 5
谢谢你!