Integrate third party tax table into paypal using php/mysql - php

I am using Website Payments Standard and have numerous zip codes I'd like to apply for tax rates (more than I can manually input one at a time into Paypal's standard tax rules). Is there a way for the checkout solution to connect to my database (a mysql database) where I have the zip codes + tax rates? Is it possible for all this to happen in the shopping cart experience?

Yes, you can use the PayPal Instant Update API.
In a nutshell; you'll need to set up a script on your server which accepts a POST with shipping address data from PayPal, and requires you to return an appropriate response as output including the tax/shipping amount. This will then be used during checkout as the shipping/tax amount.
Have a look at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables#id09CA80W0Z5Z and https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_CallbackAPI
For Website Payments Standard, base a button off of the following form code:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="name#test.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="https://link-to-your-return-script.php">
<!--item 1 -->
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="item_name_1" value="Gladiator - Extended">
<input type="hidden" name="item_number_1" value="3425654">
<input type="hidden" name="amount_1" value="10">
<!--item 2 -->
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="item_name_2" value="Casino - Extended ">
<input type="hidden" name="item_number_2" value="4354567754">
<input type="hidden" name="amount_2" value="2">
<!--CALLBACK PARAMETERS -->
<input type="hidden" name="callback_url" value="https://link-to-your-callback-script.php">
<input type="hidden" name="callback_timeout" value="4">
<input type="hidden" name="callback_version" value="61"> <!--Required! -->
<input type="hidden" name="fallback_shipping_option_name_0" value="Option 1">
<input type="hidden" name="fallback_shipping_option_amount_0" value="1">
<input type="hidden" name="fallback_shipping_option_is_default_0" value="1">
<input type="hidden" name="fallback_shipping_option_name_1" value="Option 2">
<input type="hidden" name="fallback_shipping_option_amount_1" value="3">
<input type="hidden" name="fallback_shipping_option_is_default_1" value="0">
<input type="hidden" name="fallback_insurance_option_offered" value="0">
<!--CALLBACK PARAMETERS END-->
<input type="submit" value="Upload cart">
</form>
Whenever a buyer checks out, you will receive a POST with data on https://link-to-your-callback-script.php
The following is an example POST payload which you may receive:
CallbackRequest:
METHOD=CallbackRequest
CALLBACKVERSION=57
TOKEN=EC-7TF47275R51235219
LOCALECODE=en_US
CURRENCYCODE=USD
L_NAME0=Item name
L_NUMBER0=0123456789
L_DESC0=Description of item goes here
L_AMT0=1.00
L_QTY0=1
L_ITEMWEIGHTUNIT0=
L_ITEMWEIGHTVALUE0=0
L_ITEMHEIGHTUNIT0=
L_ITEMHEIGHTVALUE0=0
L_ITEMWIDTHUNIT0=
L_ITEMWIDTHVALUE0=0
L_ITEMLENGTHUNIT0=
L_ITEMLENGTHVALUE0=0
SHIPTOSTREET=1 Main St
SHIPTOCITY=San Jose
SHIPTOSTATE=CA
SHIPTOCOUNTRY=US
SHIPTOZIP=95131
SHIPTOSTREET2=
After which you must calculate the appropriate tax / shipping amounts, and return a proper CallBackResponse message.
For example;
CallBackResponse:
METHOD=CallbackResponse&
OFFERINSURANCEOPTION=true&
L_SHIPPINGOPTIONLABEL0=UPS Next Day Air TEST5&
L_SHIPPINGOPTIONAMOUNT0=1.00&
L_TAXAMT0=0.00&
L_INSURANCEAMOUNT0=0.00&
L_SHIPPINGOPTIONISDEFAULT0=false&
L_SHIPPINGOPTIONLABEL1=UPS Express 2 Days TEST4&
L_SHIPPINGOPTIONAMOUNT1=1.50&
L_TAXAMT1=0.00&
L_INSURANCEAMOUNT1=0.0&
L_SHIPPINGOPTIONISDEFAULT1=true&
L_SHIPPINGOPTIONLABEL2=UPS Ground2 to 7 Days TEST3&
L_SHIPPINGOPTIONAMOUNT2=1.50&
L_TAXAMT2=0.00&
L_INSURANCEAMOUNT2=0.00&
L_SHIPPINGOPTIONISDEFAULT2=false
Once PayPal has received this information, it will update the shipping/tax charges automatically.
For more information, see https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECInstantUpdateAPI

Related

Unable to pass amount in paypal using _xclick

I am trying to create simple PayPal button who pass amount and quantity details to PayPal. I am unable to pass hardcore amount in PayPal. I am expecting to show result like this:
Expected output
Problem is that my amount is not transferring to PayPal. Please support to resolve. Here is my code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" amount="1.0">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="hmmdmlk#gmail.com">
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="submit" value="PayPal">
</form>
When using _xclick, which is for operations on a single item, you want:
<input type="hidden" name="item_name" value="The item name.">
<input type="hidden" name="amount" value="1.00">
The multi-item parameters you were using would be for _cart with upload=1, not _xclick
Documentation: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/

Check PayPal Payment Is completed

I have problems to make my PayPal system payment.
1. User add on cart the elements him want. (In this example, user select 3 items: PDF - HTML, PDF -JS and PDF -JS)
2. In page when appear that 3 items and button to pay (shoppingCart.php), have the next code:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="myEmail#domain.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name_1" value="PDF - HTML">
<input type="hidden" name="amount_1" value="5">
<input type="hidden" name="item_name_2" value="PDF - JS">
<input type="hidden" name="amount_1" value="7">
<input type="hidden" name="item_name_3" value="PDF - CSS">
<input type="hidden" name="amount_1" value="10">
<input type="hidden" name="return" value="PaymentCompleted.php">
<input class="btn btn-primary mt-2 m-b-20 " type="submit" value="PayNow">
<form>
3. When user completes payment, on PayPal windows, click to "Return to Shop" and go to page "PaymentCompleted.php".
4. On "PaymentCompleted.php" have a SQL script who add that 3 items on clientArea payments.
Problem I have, are the next:
If user add that 3 items, and go to PaymentCompleted.php, SQL Script add to it ClientArea without do payment.
How I can check if PayPal payment has been completed and else, prevent SQL Script add that items to clientArea?
Have a good day

Paypal send shipping country (use different values lc and country fields)

I try to integrate a paypal button payment on my website.
The website accepts users from many countries.
The website's language are english.
My users defines shipping address in my website and I provide it to Paypal with the form.
But, when I sent another country without change lc paramter, Paypal don't pre-fill country with the new.
My Problem is the opposit of this one : Paypal Hosted language bug. Based on 'country' instead of 'lc' for Paypal Express button
Example (my form) :
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="amount" value="5">
<input name="currency_code" type="hidden" value="GBP">
<input name="shipping" type="hidden" value="0.00">
<input name="tax" type="hidden" value="0.00">
<input name="return" type="hidden" value="https://my-shop.com">
<input name="cancel_return" type="hidden" value="https://my-shop.com">
<input name="notify_url" type="hidden" value="https://my-shop.com">
<input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="sales#my-shop.com">
<input name="no_shipping" type="hidden" value="1">
<input name="item_name" type="hidden" value="1234">
<input name="no_note" type="hidden" value="1">
<input name="bn" type="hidden" value="xxxx">
<input name="custom" type="hidden" value="the_buyer#gmail.com">
<input name="invoice" type="hidden" value="1223">
<input name="address_override" type="hidden" value="1">
<input name="address1" type="hidden" value="Frani Sramka 20">
<input name="address2" type="hidden" value="">
<input name="city" type="hidden" value="Prague 5">
<input name="zip" type="hidden" value="15000">
<input name="country" type="hidden" value="CZ">
<!-- Countries part -->
<input name="lc" type="hidden" value="GB">
<input name="address_country" type="hidden" value="CZECH REPUBLIC">
<input name="address_country_code" type="hidden" value="CZ">
<input name="residence_country" type="hidden" value="CZ">
<button type="submit" class="btn btn-primary">Pay by PayPal</button>
</form>
In this case, Paypal set the page language in GB (provided by lc field)
But the Paypal's Country field was pre-fill with United Kingdom, see screenshot :
But I want Paypal take my countries fields (with value CZ) into account.
Set lc field to CZ behavior
If I set lc field to CZ :
<input name="lc" type="hidden" value="CZ">
I get both language in CZ and user country pre-fill in CZ :
Brief question :
Do you know a way to :
Pre-fill user country (CZ)
Keep the choosen language (GB)
Additional information
Except this language issue, the form works
I use a custom PHP back-end technology (not a CMS with plugin)
Paypal Documentation
pre-populate my customer's PayPal sign-up form, contains country and lc description
Countries code
I saw China is 'c2' not 'cz' ? am I wrong?
You might want to force a location.
<input type="hidden" name="locale.x" value="cz_XC">
<input type="hidden" name="lc" value="GB">

how to use paypal subscription form for multiple subscriptions?

I am trying to use paypal subscription form for multiple product, but its not working.
Here is my form which i used.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="archirayan9#gmail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="item_name" value="Baseball Hat Monthly - test2 " />
<input type="hidden" name="item_number" value="asd">
<input type="hidden" name="a3" value="10.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
</form>
This form is for 1 product subscription. I want to make it for multiple products with different item_id.
I cant found any thing that help me to setup multiple product subscription using this form.
Anyone have solution how to do?

How can i send multiple items through buy now button of Paypal

I desperately need some help, I cannot find the answer anywhere.
What I need to build is a "buy now" form (or button) where it send multiple items. I am selling tickets for an event, which has different prices for Adult and Child tickets. I have already used the "Add to cart" buttons individually, but my older customers are stuggling with this, especially mobile users. Also, this is really not the most professional way of doing it in my case.
Just as an example, here is a form which is similar to what I need: http://lowfestival.es/abonos/ (I know this is not a paypal form, nor the same, but im sure you understand.
I just need 2 items (Adult and Child) with 2 quantity boxes and the Pay Now button.
If this is not possible for some reason, can anyone recommend a free 3rd party cart which could do the job?
Many many many thanks in advance for any help.
Kindest Regards
The Cart Upload command will do this for you: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/cart_upload/
For example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="youremailaddress#yourdomain.com">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="item_name_1" value="First item name">
<!-- Change this to the price of the first item -->
<input type="hidden" name="amount_1" value="15.00">
Quantity of first item:
<input type="number" name="quantity_1" size="2" min="1" max="99" required="required"><br>
<input type="hidden" name="item_name_2" value="Second item name">
<!-- Change this to the price of the second item -->
<input type="hidden" name="amount_2" value="20.00">
Quantity of second item:
<input type="number" name="quantity_2" size="2" min="1" max="99" required="required"><br>
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_buynow_cc_171x47.png">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="youremail#mail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name_1" value="beach ball">
<input type="hidden" name="amount_1" value="42">
<input type="hidden" name="item_name_2" value="towel">
<input type="hidden" name="amount_2" value="13">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" name="submit">
</form>

Categories