Marc
Marc

Reputation: 16512

Can't figure out how to charge taxes

I have set up the sales tax in my account but Paypal always return 0%

Here are the SetExpressCheckout parameters

enter image description here

This is the result

TOKEN=EC-03E58022CK445842R
&TIMESTAMP=2015-01-10T20:48:57Z
&CORRELATIONID=b875a01d29414
&ACK=Success
&VERSION=119
&BUILD=14726230

Then the user is redirected to Paypal and enter its billing address.

On the callback url, I do the GetExpressCheckoutDetails with the following parameters

enter image description here

and the result is

 TOKEN=EC-5TF12550CK165913F
&BILLINGAGREEMENTACCEPTEDSTATUS=0
&CHECKOUTSTATUS=PaymentActionNotInitiated
&TIMESTAMP=2015-01-10T21:04:05Z
&CORRELATIONID=7eefa2e1b98b5
&ACK=Success
&VERSION=119
&BUILD=14726230
&[email protected]
&PAYERID=WDUJK7NL59J7A&PAYERSTATUS=verified
&FIRSTNAME=SandboxTest
&LASTNAME=Account
&COUNTRYCODE=CA
&CURRENCYCODE=CAD
&AMT=59.99
&SHIPPINGAMT=0.00
&HANDLINGAMT=0.00
&TAXAMT=0.00
&INSURANCEAMT=0.00
&SHIPDISCAMT=0.00
&PAYMENTREQUEST_0_CURRENCYCODE=CAD
&PAYMENTREQUEST_0_AMT=59.99
&PAYMENTREQUEST_0_SHIPPINGAMT=0.00
&PAYMENTREQUEST_0_HANDLINGAMT=0.00
&PAYMENTREQUEST_0_TAXAMT=0.00
&PAYMENTREQUEST_0_INSURANCEAMT=0.00
&PAYMENTREQUEST_0_SHIPDISCAMT=0.00
&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false
&PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None
&PAYMENTREQUESTINFO_0_ERRORCODE=0

so the sales tax are not calculated

and from the documentation it looks like you have to set up the taxes yourself SetExpressCheckout with L_PAYMENTREQUEST_n_TAXAMTm

but how are you supposed to know how much to charge if you don't know where the user lives?

Upvotes: 0

Views: 254

Answers (1)

Drew Angell
Drew Angell

Reputation: 26036

After you call SetExpressCheckout and redirect the user to PayPal, they'll login and review the order, choose their shipping, etc. and are then sent back to the ReturnURL you specified.

That is where you'll call GetExpressCheckoutDetails like you did, which would typically contain the payer's shipping address. You could then calculate shipping and tax based on that address and display a final review page to your buyer which includes all of the totals.

Note that your GECD response doesn't include an address because you specified NOSHIPPING=1 in your SEC request.

When they submit that final review you'll call DoExpressCheckoutPayment, and make sure to include the shipping and tax parameters in that request in order for them to be included in the payment that gets processed at that point.

If you want to skip your own final review page, you can setup a callback service where PayPal's review page will POST the payer details to a script you have sitting on your server, which can then take the address, calculate shipping and tax values, and return them back to PayPal's review page, which populates a drop down on that page so the payer can choose from the rates your script returns. They call this the Instant Update API.

Upvotes: 2

Related Questions