Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This update to allow you to change the shipping address in the paypal express checkout #251

Open
butta74 opened this issue Sep 24, 2021 · 0 comments

Comments

@butta74
Copy link

butta74 commented Sep 24, 2021

I ask if it is possible to make this change.

File \vendor\omnipay\paypal\src\Message\RestAuthorizeRequest.php Line 254 ADD:

    $shipping_address = $this->getShippingAddress();
    if ($shipping_address) {
        $data['transactions'][0]['item_list']["shipping_address"] = $shipping_address;
    }

File \vendor\omnipay\common\src\Common\Message\AbstractRequest.php -- Line 541 ADD:

/**
 * Custom Shipping Address
 */
public function getShippingAddress()
{
    return $this->getParameter('shipping_address');
}

/**
 * Set Shipping Address
 * @return $this
 */
public function setShippingAddress($value)
{
    return $this->setParameter('shipping_address', $value);
}

So in my controller I can call "purchase" method with custom shipping_addres :

$response = $this->gateway->purchase([
'transactionId' => $myIdTransaction
'amount' => $tot_payment,
'currency' => $currency,
'returnUrl' => $myurl,
'cancelUrl' => $myCancelUrl,
'shipping_address' => [
"line1"=> "111 First Street",
"city"=> "Saratoga",
"country_code"=> "US",
"postal_code"=> "95070",
"state"=> "CA"
]
])->send();

It's work for me.
Thanks
Img1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant