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

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">

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/

PayPal IPN notifies with protection_eligibility=Ineligible

This is in a custom PHP eCommerce application. I have no problem receiving and verifying a PayPal IPN response, but it never returns with seller protection eligibility.
This is the generated IPN submission form:
the data has been replaced with dummy data for this question, but it is legitimate data in the application
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name" value="Order #123456789">
<input type="hidden" name="item_number" value="123456789">
<input type="hidden" name="invoice" value="123456789">
<input type="hidden" name="amount" value="50.00">
<input type="hidden" name="first_name" value="John">
<input type="hidden" name="last_name" value="Smith">
<input type="hidden" name="contact_phone" value="123 123 1234">
<input type="hidden" name="payer_email" value="customer#gmail.com">
<input type="hidden" name="address_country" value="Canada">
<input type="hidden" name="address_country_code" value="CA">
<input type="hidden" name="address_city" value="Test City">
<input type="hidden" name="address_name" value="John Smith">
<input type="hidden" name="address_state" value="Provice">
<input type="hidden" name="address_street" value="123 Test Street">
<input type="hidden" name="address_zip" value="A1B 2C3">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="address_status" value="confirmed">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="return_url" value="http://custom-ecommerce-app.com/thank-you.html">
<input type="hidden" name="protection_eligibility" value="SellerProtection">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="notify_url" value="http://custom-ecommerce-app.com/paypal-ipn-notify.php">
<input type="hidden" name="custom" value="">
<input type="hidden" name="business" value="payments#custom-ecommerce-app.com">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="bn" value="PP-BuyNowBF">
</form>
In the IPN response received, protection_eligibility is always Ineligible. This occurs with or without the sandbox. The business/recipient account is configured for seller protection.
I've tried entering generating the submission form with address information that is identical to the profile information of the sandbox customer account, and I get the same result (Ineligible).
What do I need to change in my account or submission form for this to work?
SOLUTION
no_shipping must have a value of 0 (prompt for optional shipping address) or 2 (prompt for required shipping address). Orders with no shipping cannot be eligible for seller protection.

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>

Paypal dynamic return url not working

I am trying to make a paypal payment and I have a problem when returning to my page after the payment is completed.
I want to do it dynamically (so I do not want to set it in the paypal's account option, as I may use this account for other things). This is the form I send to paypal:
<form id="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="notify_url" value="http://zopomobile.es/pruebas/modules/rmaforsat/ipn_paypal.php">
<input type="hidden" name="item_name_1" value="Pago de su orden a Zopomobile.">
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="amount_1" value="259.12">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="custom" value="152">
<input type="hidden" name="business" value="admin-facilitator#zopomovil.es">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="return" value="http://zopomobile.es/pruebas">
<input type="hidden" name="cancel" value="http://zopomobile.es/pruebas/NO">
<input type="hidden" name="rm" value="2">
</form>
I have tried changing the "return" variable to "return_url", still not working.
If you want to automatically re-direct to "http://www.zopomobile.es/pruebas/"
then you need to turn on "Auto Return" on your PayPal profile.
Right now, Auto Return is "OFF" in your profile.
The return parameter is return
https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments
Check above link to turn on the "Auto Return" feature.

Integrate third party tax table into paypal using php/mysql

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

Categories