omn​​ipay paypal express不返回地址 [英] omnipay paypal express not returning address

查看:247
本文介绍了omn​​ipay paypal express不返回地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用全向设置: https://github.com/adrianmacneil/omnipay 处理Paypal快速结帐。



这个过程很好,因为用户被重定向到paypal - >他们登录并选择支付 - >他们返回我的网站



我遇到的问题是,我需要捕获他们输入到paypal的地址作为他们的帐单/送货地址。

p>

要将用户发送到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'=> '

) - > send();

$ response-> redirect();

当用户退回时,我有以下:

  $ 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'=> '

) - > send();

echo $ responsemsg = $ response-> getMessage();

echo'< br>< br>< br>';
$ data = $ response-> getData();
print_r($ data);

响应消息中没有任何内容或原始数据包含客户地址。

$ b $

解决方案

没有任何人得到这个工作,因为我奋斗,这是完成交易的最后一步。

对于那些试图获得这项工作的人,就像Adrian所说的。



你先做正常的全能paypal付款,然后:


  1. 获取您获得的令牌

  2. 使用getexpresscheckoutdetails方法第二次调用paypal

  3. 这会返回您需要的所有信息。

此处的API信息: https://cms.paypal.com/uk/cgi-bin/?cmd=_render- content& content_ID = developer / e_howto_api_nvp_r_GetExpressCheckout详细信息



php脚本paypal为您提供:



https://cms.paypal.com/cms_content/ ES / es_ES / files / developer / nvp_ECGetExpressCheckout_php.txt


I am using the omnipay setup here: https://github.com/adrianmacneil/omnipay to process a paypal express checkout.

The process works fine in that the user is redirected to paypal -> they login and choose to pay -> they get returned to my site at which point I capture the payment.

The problem I've got is that I need to capture the address they have entered into paypal as their billing / shipping address.

To send the user across to paypal I have the following:

$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(); 

When the user is returned I have the following:

$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);

Nothing in the response message or the raw data contains the customer address.

Has anyone got this working as i'm struggling and it's the final step to complete the transaction.

解决方案

For those who are trying to get this work it's as Adrian said.

You first do the normal omnipay paypal payment and then afterwards:

  1. get the token you were given
  2. preform a second call to paypal using the call getexpresscheckoutdetails method
  3. this returns all the info you need

API info here: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetExpressCheckoutDetails

The php script paypal provide to do it all for you:

https://cms.paypal.com/cms_content/ES/es_ES/files/developer/nvp_ECGetExpressCheckout_php.txt

这篇关于omn​​ipay paypal express不返回地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆