我正在尝试完成我的 omnipay laravel 4 和 Payfast 集成。我现在可以成功进行交易,但我无法让 notify_url 正常工作。
$gateway = Omnipay::create('PayFast');
$gateway->setMerchantId = '10000100';
$gateway->setMerchantKey = '46f0cd694581a';
$response = $gateway->purchase([
'merchant_id' => '10000100',
'merchant_key' => '46f0cd694581a',
'return_url' => 'http://signup.areweup.co.za/return',
'cancel_url' => 'http://signup.areweup.co.za/cancel',
'notify_url' => 'http://signup.areweup.co.za/notify',
'name_first' => 'Warren',
'name_last' => 'Hansen',
'm_payment_id' => '8542',
'amount' => '39.00',
'item_name' => 'Are We Up',
'description' => 'Peace of mind at just R39 a month.'
])->send();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
我有一个 POST 路由设置来接收 ITN 响应
$gateway = Omnipay::create('PayFast');
$gateway->setMerchantId = '10000100';
$gateway->setMerchantKey = '46f0cd694581a';
$response = $gateway->CompletePurchase([
'merchant_id' => '10000100',
'merchant_key' => '46f0cd694581a',
'return_url' => 'http://signup.areweup.co.za/return',
'cancel_url' => 'http://signup.areweup.co.za/cancel',
'notify_url' => 'http://signup.areweup.co.za/notify',
'name_first' => 'Warren',
'name_last' => 'Hansen',
'm_payment_id' => '8542',
'amount' => '39.00',
'item_name' => 'Are We Up',
'description' => 'Peace of mind at just R39 a month.'
])->send();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
notify_url 的唯一区别是我调用 CompletePurchase 方法。在这里的任何帮助将不胜感激。ITN Payfast 文档在这里:payfast itn 文档