<p>I ended up developing a real quick plugin to make an additional call to Paypal to get and store the address to the order.</p>

<p><a href="https://github.com/wojodesign/paypaladdresser" rel="nofollow noreferrer">https://github.com/wojodesign/paypaladdresser</a></p>

CC BY-SA 3.0
2017-05-31T01:17:18.473Z
That's great - one does wonder, though, if perhaps Commerce itself shouldn't perhaps deal with it as Paypal customers do routinely use the Paypal facilities for address handling I guess.  Perhaps you should raise this with Luke holder at some point?
Jeremy Daalder
CC BY-SA 3.0
2017-05-30T18:42:58.297Z
2017-05-30T18:42:58.297Z
Stephen McKinney
<p>Well, after a transaction, you can log the full gateway response etc using this event: <a href="https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction" rel="nofollow noreferrer">https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction</a></p>

<p>(See what you can get at/log at <a href="https://craftcommerce.com/docs/transaction-model" rel="nofollow noreferrer">https://craftcommerce.com/docs/transaction-model</a>)</p>

<pre><code>craft()-&gt;on('commerce_transactions.onSaveTransaction', function ($event){

      $transaction = $event-&gt;params['transaction'];
      BusinessLogicPlugin::log($transaction-&gt;response);

 });
</code></pre>

<p>...that should hopefully get you started on grabbing the data you need (I presume PayPal returns the address) - and then adding that to the cart at that point.  </p>

CC BY-SA 3.0
2017-05-23T15:48:06.440Z
Thanks for the help, but unfortunately no, Paypal does not return the address. I ended up writing a plugin to make another request to Paypal onSaveTransaction to get the address for the order.  Once this project is finished I'll post the github link here.
Stephen McKinney
CC BY-SA 3.0
2017-05-23T23:16:31.807Z
Good to know but how odd it doesn't return it initially.  I checked our main gateway and it apparently does, although there's no facility for the customer to change it with the gateway so it's really kinda pointless there other than to check it's receiving what we think it is receiving!
Jeremy Daalder
CC BY-SA 3.0
2017-05-25T20:12:04.567Z
Well craft commerce hard codes the paypal parameter to hide shipping when it sends the request to paypal. I had to add in a hook to modify the request data to put it back in. I couldn't get paypal to return back the shipping address in the raw gateway response, but commerce will still have the shipping address you sent to paypal stored in the order.

`public function commerce_modifyPaymentRequest($data){
     $data['noShipping'] = 0;
       return $data;
    }`
Stephen McKinney
CC BY-SA 3.0
2017-05-19T00:23:27.550Z
2017-05-23T06:11:08.787Z
2017-05-23T06:11:08.787Z
Jeremy Daalder
<p>When I checkout via Paypal express if I don't already have an address added to the cart model, when the paypal checkout process returns back there will be no address attached to the order. </p>

<p>The reason I want the address to be sent back afterwards is that i want to send customers to paypal from the cart page so there is no address form prior to leaving to paypal. This flow is something possible on say, woocommerce.</p>

<plugin-craftcommerce><ecommerce>
Can Craft Commerce receive back the address used in paypal express checkout?
# Can Craft Commerce receive back the address used in paypal express checkout?

(Asked by: username_0 on 2017-05-17)

When I checkout via Paypal express if I don't already have an address added to the cart model, when the paypal checkout process returns back there will be no address attached to the order.

The reason I want the address to be sent back afterwards is that i want to send customers to paypal from the cart page so there is no address form prior to leaving to paypal. This flow is something possible on say, woocommerce.

**Tags:** plugin-craftcommerce, ecommerce

---

## 2 answers

### Answer by username_0 on 2017-05-30. Score: 1 | Accepted answer

I ended up developing a real quick plugin to make an additional call to Paypal to get and store the address to the order.

<https://github.com/wojodesign/paypaladdresser>

> **Comments:**
> **username_1**: That's great - one does wonder, though, if perhaps Commerce itself shouldn't perhaps deal with it as Paypal customers do routinely use the Paypal facilities for address handling I guess.  Perhaps you should raise this with Luke holder at some point?  

---

### Answer by username_1 on 2017-05-19. Score: 1

Well, after a transaction, you can log the full gateway response etc using this event: https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction
(See what you can get at/log at https://craftcommerce.com/docs/transaction-model)
craft()->on('commerce_transactions.onSaveTransaction', function ($event){

      $transaction = $event->params['transaction'];
      BusinessLogicPlugin::log($transaction->response);

 });

...that should hopefully get you started on grabbing the data you need (I presume PayPal returns the address) - and then adding that to the cart at that point.

> **Comments:**
> **username_0**: Thanks for the help, but unfortunately no, Paypal does not return the address. I ended up writing a plugin to make another request to Paypal onSaveTransaction to get the address for the order.  Once this project is finished I'll post the github link here.  
> **username_1**: Good to know but how odd it doesn't return it initially.  I checked our main gateway and it apparently does, although there's no facility for the customer to change it with the gateway so it's really kinda pointless there other than to check it's receiving what we think it is receiving!  
> **username_0**: Well craft commerce hard codes the paypal parameter to hide shipping when it sends the request to paypal. I had to add in a hook to modify the request data to put it back in. I couldn't get paypal to return back the shipping address in the raw gateway response, but commerce will still have the shipping address you sent to paypal stored in the order.  `public function commerce_modifyPaymentRequest($data){      $data['noShipping'] = 0;        return $data;     }`  

---

