你好,我在我的项目中使用带有migs集成的万能github。示例代码似乎不起作用。有人能帮我吗?
require_once 'vendor/autoload.php';
use \Omnipay\Omnipay as omnipay;
$gateway = Omnipay::create('Migs_ThreeParty');
$gateway->setMerchantId('foo');
$gateway->setMerchantAccessCode('foo');
$gateway->setSecureHash('foo');
try {
$response = $gateway->purchase(array('amount' => '0.00', 'currency' => 'AED', 'returnURL' => 'www.google.com.pk'))->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
//$url = $response->getRedirectUrl();
//$data = $response->getRedirectData();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
} catch (\Exception $e) {
// internal error, log exception and display a generic message to the customer
exit('Sorry, there was an error processing your payment. Please try again later.');
}"$gateway->setSecureHash“== "$SECURE_SECRET”是否如示例链接http://integrate-payment-gateway.blogspot.in/2012/01/migs-payment-gateway-integration-php.html所示
上面的代码要求提供redirectUrl和transactionId。在哪里指定呢?
发布于 2016-01-10 13:34:29
require_once 'vendor/autoload.php';
use \Omnipay\Omnipay as omnipay;
$gateway = Omnipay::create('Migs_ThreeParty');
$gateway->setMerchantId('MerchantId');
$gateway->setMerchantAccessCode('MerchantAccessCode');
$gateway->setSecureHash('SecureHash');
try {
$response = $gateway->purchase(array(
'amount' => '10.00', // amount should be greater than zero
'currency' => 'AED',
'transactionId' => 'refnodata', // replace this for your reference # such as invoice reference #
'returnURL' => 'http://yourdomain.com/returnPage.php'))->send();
if ($response->isRedirect()) {
$url = $response->getRedirectUrl(); // do whatever with the return url
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
} catch (\Exception $e) {
// internal error, log exception and display a generic message to the customer
echo $e;
exit('Sorry, there was an error processing your payment. Please try again later.');
}发布于 2016-08-15 23:22:23
我也有同样的问题,returnURL是关于什么的?答案是Migs_TwoParty和Migs_ThreeParty方法之间的区别。
Migs_ThreeParty将控制传递给支付提供者,并在处理付款时将控制传递回您的网站。文档是这样写的:
持卡人的Internet浏览器被重定向,以便将事务请求接收到支付服务器以处理事务。处理事务后,持卡人的Internet浏览器将返回到您在交易中指定的网页以及事务响应。接收信息的事务响应处理完成事务。
如果您想自己完成与网关的所有接口,您应该使用Migs_TwoParty方法。因此,不需要returnURL。
穆雷干杯
https://stackoverflow.com/questions/34612747
复制相似问题