Paypal Pay Now Button with language support - php

When the user click on the paypal pay button in my site, it will redirect to paypal payment page, which require the user to enter their paypal credentials. Currently, the paypal payment page is in english. I want it to be in Spanish or other language based on my site language. Below is the post data that i send to paypal.
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $paypal['merchant_account']; ?>">
<input type="hidden" name="return" value="<?php echo $paypal['webpage_url'].$language_path.$paypal['return_url']; ?>">
<input type="hidden" name="currency_code" value="<?php echo $currency; ?>">
<input type="hidden" name="item_name" value="<?php echo $itemName; ?>">
<input type="hidden" name="amount" value="<?php echo number_format((float) $order->getTotal(), 2, '.', ''); ?>">
i tried to do something like :
<input type="hidden" name="locale" value="es_es">
But it does not work. How can I achieve this?

You should be using lc=es_es
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="vimaluk#gmail.com">
<input type="hidden" name="lc" value="es_es">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Related

Paypal Payment Integration not returning any values

This is my code in PHP for paypal payment integration.Payments are being done successfully. The response URL should be http://codaty.com/success.php?tx=83437E384950D&st=Completed&amt=10.00&cc=USD&cm=&item_number=1 .But I am getting the URL as http://codaty.com/success.php. I am not getting any parameters in return. Is this the right method for integration. Can I get a sample code for reference.
$paypal_url='https://www.paypal.com/cgi-bin/webscr';
$paypal_id='codaty#outlook.com';
<form action="<?php echo $paypal_url; ?>" method="post" name="frmPayPal1">
<input type="hidden" name="business" value="<?php echo $paypal_id; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="QR Code">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="userid" value="<?=$session_userid?>">
<input type="hidden" name="amount" value="0.10">
<input type="hidden" name="cpp_header_image" value="http://codaty.com/images/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="cancel_return" value="http://codaty.com/cancel.php">
<input type="hidden" name="return" value="http://codaty.com/success.php">
<input type="image" src="images/card03.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" class="img-responsive">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Add addition Return method input hidden field <input type="hidden" name="rm" value="2">
1 — the buyer's browser is redirected to the return URL by using the GET method, but no payment variables are included.
2 — the buyer's browser is redirected to the return URL by using the POST method, and all payment variables are included.
And then in success.php :
echo "<pre>";
print_r($_POST);
More details : HTML Variables for PayPal Payments Standard

How to get Paypal 'Add to Cart' button response?

I m trying to add a Paypal Add to cart button in my application. For that i create code from paypal sanbox. This is my form,
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="EGZD52TPWUERY">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Fees">
<input type="hidden" name="item_number" value="255">
<input type="hidden" name="amount" value="85.00">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:" />
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="my-application/paypal/success">
<input type="hidden" name="tax_rate" value="0.000">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="item_id_<?php echo $res_1->id; ?>" value="<?php echo $res_1->id; ?>" />
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The payment transaction is completed successfully and the redirect is done perfectly to my application. But the problem is i didn't get any response in that page. I tried var_dump($_POST). It retruns null. Don't know why i didn't get any response. Any help is appreciated.
Check the following link and update your paypal account.The response is in $_GET
https://developer.paypal.com/webapps/developer/docs/classic/products/payment-data-transfer/

paypal info not completing on live version

Im having difficulty with paypal, i can get it working perfectly in test mode but not in live mode....
<form class="paypal-form" action=" https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="live#email.ie">
<input type="hidden" name="item_name" value="qparcel">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" id="amount" value="<?php echo $paypal_amount; ?>">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="custom " value="<?=$orderid?>">
<input type="hidden" name="custom_more" value="<?php echo 'test2'; ?>">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="<?php echo get_site_url(); ?>/payment-complete">
<input type="image" src="<?php echo get_option("siteurl"); ?>/wp-content/themes/qparcel/images/pay-with-pp.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
RESPONSE PAGE
if ( isset($_POST['mc_gross']) ) {
// do stuff
}
When Im in test mode this works perfectly, in live mode it does not.
Is there a chance $_POST['mc_gross'] doesnt appear on the live version?
You didn't really explain much here, but it looks like you're trying to use PDT and get transaction data back to your return URL..??
You just need to make sure that's all configured in your live account the same way it's configured in your test account. Those are completely separate from each other, of course, so you have to set them up separately.

php add to cart paypal button problem - problem with my amount

I have a paypal sandbox "Add to Cart" where if a user adds a particular product from a database into an account, it should display the price of that product based on what it is in the database.
Say I have these two products;
prodID: 1
product: Hat
price: £5.00
prodID: 2
product: socks
price: £3.00
however, when I add these products to cart in sandbox, its says they are £0.50 when they clearly are not. Here is my code;
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="7UCL9YCYYXL3J">
<input type="hidden" name="item_name" value="<?php echo $row['product']; ?>">
<input type="hidden" name="item_number" value="<?php echo $row['prodID']; ?>">
<input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
<input type="hidden" name="currency_code" value="GBP">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
it seems this has the problem (i dont know how to handle the _s-xclick:
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="7UCL9YCYYXL3J">
instead, this has not:
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="youremail#yahoo.gr">

Paypal Payment Notification

I would like to have the Notification like if the transaction made is success or failure.
My Code :
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<!--<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="T4ETNVYF7D898">
-->
<input type="hidden" name="business" value="uresh._1304751477_biz#yahoo.com">
<input type="hidden" name="item_name" value="Ramakdu">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="return" value="http://localhost/paypal/">
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<?php
print_r($_REQUEST);
?>
Try this:
<input type="hidden" name="return" value="http://example.com/paymentsuccess" />
<input type="hidden" name="notify_url" value="http://example.com/paymentsuccess">
<input type="hidden" name="cancel_return" value="http://example.com/paymentfailure" />
Return should be a link and not "localhost".
Keep in mind that "notify_url" must be a publicly accessible URL. Return will work for testing, but notify_url is a POST initiated from the PayPal-side, and must thus be publicly acc

Categories