Skip to content

Commit

Permalink
Ability to specify 'subtotal' and 'shipping' costs for express checko…
Browse files Browse the repository at this point in the history
…ut (#175)
  • Loading branch information
DivineOmega authored and srmklive committed Jan 17, 2018
1 parent 6c336d6 commit 0962413
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Services/ExpressCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription
public function setExpressCheckout($data, $subscription = false)
{
$this->post = $this->setCartItems($data['items'])->merge([
'PAYMENTREQUEST_0_ITEMAMT' => $data['total'],
'PAYMENTREQUEST_0_ITEMAMT' => isset($data['subtotal']) ? $data['subtotal'] : $data['total'],
'PAYMENTREQUEST_0_AMT' => $data['total'],
'PAYMENTREQUEST_0_PAYMENTACTION' => $this->paymentAction,
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->currency,
Expand All @@ -113,6 +113,10 @@ public function setExpressCheckout($data, $subscription = false)
'LOCALE' => $this->locale,
]);

if (isset($data['shipping'])) {
$this->post['PAYMENTREQUEST_0_SHIPPINGAMT'] = $data['shipping'];
}

$this->setExpressCheckoutRecurringPaymentConfig($data, $subscription);

$response = $this->doPayPalRequest('SetExpressCheckout');
Expand Down

0 comments on commit 0962413

Please sign in to comment.