我在这里使用omnipay设置:https://github.com/adrianmacneil/omnipay来处理paypal快速结账.
该过程工作正常,用户被重定向到paypal - >他们登录并选择支付 - >他们返回我的网站,此时我捕获付款.
我遇到的问题是我需要将他们输入Paypal的地址作为他们的账单/送货地址.
要将用户发送到paypal,我有以下内容:
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('XX-USERNAME_XX');
$gateway->setPassword('XX_PASSWORDXX');
$gateway->setSignature('XX_SIG_XX');
$gateway->setTestMode(true);
$response = $gateway->purchase(
array(
'cancelUrl'=>'http://www.XXX.co.uk/',
'returnUrl'=>'http://www.XXX.co.uk/paypalexpress_confirm',
'amount' => $totalamount,
'currency' => 'GBP'
)
)->send();
$response->redirect();
Run Code Online (Sandbox Code Playgroud)
当用户返回时,我有以下内容:
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('XX-USERNAME_XX');
$gateway->setPassword('XX_PASSWORDXX');
$gateway->setSignature('XX_SIG_XX');
$gateway->setTestMode(true);
$response = $gateway->completePurchase(
array(
'cancelUrl'=>'http://www.XXX.co.uk/',
'returnUrl'=>'http://www.XXX.co.uk/paypalexpress_confirm',
'amount' => $totalamount,
'currency' => 'GBP'
)
)->send();
echo $responsemsg=$response->getMessage();
echo '<br><br><br>';
$data = $response->getData();
print_r($data);
Run Code Online (Sandbox Code Playgroud)
响应消息或原始数据中的任何内容都不包含客户地址.
有没有人得到这个工作,因为我正在努力,这是完成交易的最后一步.
我试图在付款期间通过PayPal获得一些自定义值,以便PayPal会在调用IPSN端点时将其返还给我.
我使用常规的html表单,一切都很好,但如果我使用CI-Merchant执行此操作,则自定义值为空.
$params = array(
'amount' => $amount_dollars,
'currency' => 'CAD',
'description' => $paypal_description,
'custom' => 'some_id='.$some_id_value,
'return_url' => base_url('callback'),
'cancel_url' => base_url('callback-cancelled'));
$response = $this->merchant->purchase($params);
Run Code Online (Sandbox Code Playgroud)
有谁知道我怎么能让这个工作?
谢谢伊万