我正在尝试通过 PayPal - OmniPay 将自定义值传递给付款
这是我使用的代码:
$response = $gateway->purchase(
array(
'cancelUrl'=>base_url().'checkout/cancel',
'returnUrl'=>base_url().'checkout/confirm',
'amount' => number_format($retn['invoiceDatas']['price'], 2, '.', ''),
'description' => 'Facture #'.$id,
'currency' => 'EUR',
'transactionid'=> $id,
'custom' => $id,
'description' => 'Facture'
)
)->send();
$response->redirect();
这是结帐页面的代码:
$response = $gateway->completePurchase(array('amount' => 75.00, 'currency' => 'EUR'))->send();
$data = $response->getData(); // this is the raw response object
echo '<pre>';
print_r($data);
echo '</pre>';
但在数据打印数组中我有很多信息,但没有关于“transactionID”或“custom”变量的信息..
请帮忙。谢谢
最佳答案
Omnipay/PayPal 中没有自定义
参数。
您应该将此数据存储在您的数据库中,然后根据 transactionId 进行查找。参数。
由于 PayPal 不会将此返回给您,因此最简单的解决方案是创建自定义 returnUrl
。例如:
'returnUrl' => base_url().'checkout/confirm/'.$id,
然后当您的客户登陆 returnUrl 时,您可以根据段 3(交易 ID)从数据库中查找交易,并将其标记为已付款。
关于php - 带有 omnipay 的 CodeIgniter 自定义值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24108899/