这是我的示例代码,但是我收到一条响应,指出“缺少一个或多个参数或这些参数无效”。我在pinpayments API的实现中有问题吗?
$post = array();
$post['email'] = 'chi@gmail.com';
$post['amount'] = 10.00;
$post['description'] = 'website payment';
$post['ip_address'] = $_SERVER['REMOTE_ADDR'];
$post['customer_token]'] = 'cus_n8k1YbNqgf1Kk4IlKWNN_g';
// Create a curl handle
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $private_api_key); //authenticate
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //make sure it returns a response
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // allow https verification if true
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // allow https verification if true
curl_setopt($ch, CURLOPT_POST, 1); //tell it we are posting
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //tell it what to post
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); //response comes back as json
// Execute
$response = curl_exec($ch);
// Check if any error occurred
if(!curl_errno($ch)){$info = curl_getinfo($ch);}
// Close handle
curl_close($ch);
//Decode JSON
$response = json_decode($response, true);
//Success?
if(!empty($response['response']['success']) && $response['response']['success'] == 1)
{
echo 'Successufully sent';
}
else
{
echo 'Error: ' . $response['error_description'];
}