【发布时间】:2014-07-13 16:57:19
【问题描述】:
我正在尝试使用 eway 付款方式向客户收费。我正在通过 curl 实现该过程,这是该函数的代码。
public function testing_direct() {
$url = 'https://api.sandbox.ewaypayments.com/DirectPayment.json'; // PROD
$postData = array(
'Method' => 'TokenPayment',
'TransactionType' => 'Recurring',
'TokenCustomerID' => '918549937032',
'TotalAmount' => '1995',
'InvoiceNumber' => '123',
'InvoiceDescription' => 'testing'
);
$ch = curl_init($url);
$api_authentication = base64_encode('####;****');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json','Authorization:####'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));
$response = curl_exec($ch);
// Check for errors
if ($response === FALSE) {
die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
print_r($responseData);
die;
}
此代码根本不打印任何内容...错误日志中也没有任何内容...任何关于它为什么不工作的想法??
谢谢
【问题讨论】:
标签: php curl payment-gateway