Establishment of tax amount in Active Sale / PayPal Express Checkout

I need to know how to transfer tax amount to PayPal Express Checkout using active merchant and rails. Everything works (completion of transactions), except that I can’t understand how to set the tax.

Thank you for your help!

+3
source share
2 answers

Here's how to do it.

The following code will establish a courier courier purchase for 2 items at different prices ($ 5 and 10), plus added taxes (50 cents) and without shipping or handling charges.

response = YOUR_PAYPAL_GAETWAY_NAME.setup_purchase(1550,
  :subtotal => 1500,
  :shipping => 0,
  :handling => 0,
  :tax => 50,
  :ip     => CLIENT_IP, # you might want to use "request.remote_ip" method from a controller to obtain this value

  :items => [
             {:name => 'ITEM_NAME_1', :description => 'ITEM_DESC_1', :amount => 500, :quantity => 1}, 
             {:name => 'ITEM_NAME_2', :description => 'ITEM_DESC_2', :amount => 1000, :quantity => 1}
            ],

  :return_url        => 'http://SOME/URL',
  :cancel_return_url => 'http://MAYBE/ANOTHER/URL'
)

redirect_to YOUR_PAYPAL_GAETWAY_NAME.redirect_url_for(response.token)

NOTES:

  • All amounts must be in cents.

  • 4 [: subtotal,: shipping,: handling,: tax] , , , , . , , , , , PayPal.

  • : , .. (item1 * item1) + (item2 * item2) ..

  • ( 1550 ) : subtotal +: shipping +: +: paypal ( )

+7

, , - - , , , .

4 ': subtotal,: shipping,: handling,: tax' available, , .

+4

Source: https://habr.com/ru/post/1719803/


All Articles