Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass shipping address when calling PayPal API /payments/payment

Tags:

php

api

paypal

I'm using the PayPal API to handle PayPal-payments in my eCommerce-system.

1: Get token

v1/oauth2/token

2: Create payment

v1/payments/payment

3: Execute payment

v1/payments/payment/-ID-/execute/

After step #2 I refer the user to the PayPal-page to login and confirm the payment. The user gets the own shipping address displayed. But I want to override this address with the address the user entered in the checkout of my online-shop.

I tried to set the payer_info -> shipping_address with shipping address object. No errors from paypal but the shipping address is the same.

https://developer.paypal.com/webapps/developer/docs/api/#shippingaddress-object

like image 636
rakete Avatar asked Jan 04 '16 12:01

rakete


2 Answers

This is a US Merchant solution only. Take a look at this Paypal Developer Documentation here.

When is comes to Paypal you almost always can override settings you just need to dig into the documentation and find the right combination. What I think you need is found in the second choice down:

Use the address_override variable. / See Overriding Addresses Stored With PayPal.

I'm in class at the moment so I can help more later if you need but for us to really help you out we need to see code samples of what your already attempting.

EDIT
So do what your already doing sounds right, just add the override commands where appropriate.

Please add your code if your still having trouble.

like image 139
Blizzardengle Avatar answered Sep 28 '22 07:09

Blizzardengle


  1. Define a 'shipping_address'
    https://developer.paypal.com/docs/api/#shippingaddress-object

  2. Add the 'shipping_address' to your 'item_list'
    https://developer.paypal.com/docs/api/#itemlist-object

like image 45
Enric Tordera Avatar answered Sep 28 '22 09:09

Enric Tordera