PayPal API with Laravel - Updating of data

前端 未结 4 683
囚心锁ツ
囚心锁ツ 2021-02-14 10:51

I\'m trying to implement the API of PayPal payment with Laravel 5.1. But when I log in to PayPal (sandbox), it uses the addre

4条回答
  •  忘了有多久
    2021-02-14 11:20

    I think this is the relevant documentation you are looking for.

    For people who already have PayPal accounts and whom you already prompted for a shipping address before they choose to pay with PayPal, you can use the entered address instead of the address the person has stored with PayPal.

    Instead of using the address saved in their account,

    The payer is shown the passed-in address but cannot edit it. No address is shown if the address is invalid, such as missing required fields like country, or if the address is not included at all.


    Edit: Try something like this in place of what you have.

    $address = new ShippingAddress();
    $address->setCity('Toronto');
    $address->setState('ON');
    $address->setCountryCode('CA');
    $address->setLine1('123 Fake Street');
    $address->setPostalCode('M1M1M1');
    
    $payerInfo = new PayerInfo();
    $payerInfo->setShippingAddress($address);
    
    $payer = new Payer();
    $payer->setPaymentMethod('paypal');
    

提交回复
热议问题