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

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

Related

Can't get item_name from PayPal return data array

Good morning!
I have an issue with my PayPal payment.
There is my PayPal form:
<form id="upsell_form_paypal" name="_xclick" action="https://www.paypal.com/it/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="admin#test.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="return" value="https://test.com/thank-you.php?type=upsell&payment=paypal">
<input type="hidden" id="upsell_notify_url" name="notify_url" value="https://test.com/payment.php?type=upsell">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name" id="item_name" value="Upsell-1">
<input type="hidden" name="amount" id="paypal_amount" value="0.01"><!-- PRICE -->
<input type="hidden" name="custom" id="paypal_custom" value="170907265"><!-- DEAL ID-->
<input type="hidden" name="payment_type" id="paypal_type_1234565" value="upsell"><!-- DEAL ID-->
<input type="image" class="image" style="margin-top:0" src="https://www.test.com/wp-content/uploads/2016/08/pagadesso.gif" border="0" name="submit" alt="Pay via PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
This array I get after payment. In my notify_url file, I can get all variable values except item_name. item_name is empty and I can't get it value.
What could it be? On Friday item_name working fine and I got its value, but from yesterday I can't get it anymore...

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

Paypal Pay Now Button with language support

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>

PayPal Payments Standard - change shipping and handling to just shipping

I am using PayPal Payments Standard with my own button code as follows. This works exactly as I would like except for one thing. In the PayPal shopping cart and on the invoicing, the display shows "Shipping and Handling". In California, I have to pay taxes on Handling fees. Can I make the display show "Shipping" only without the "Handling?
I tried to pass both a "handling" and a "handling-cart" input attribute with both empty and zero as values but that had no impact.
<form target="paypal" action="<?=PAYPAL_URL?>" method="post">
<input type="hidden" name="business" value="<?=PAYPAL_BUSINESS?>">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="amount" value="12.50">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shopping_url" value="<?=$url?>">
<input type="hidden" name="shipping" value="5.00" />
<input type="hidden" name="shipping2" value="5.00">
<input type="hidden" name="item_name" value="stain">
<input type="image" src="images/add_to_cart.png" border="0" name="submit" alt="Add to Cart">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Want to connect my shopping cart total price to a paypal checkout

I have a displaycart.php page where it displays all items I have in a shopping cart, each item has an ItemUnitPrice field where it shows the unit price of the item.
If I have say 6 items in the cart then I want to add up the total ItemUnitPrice fields and set that amount to be paid with PayPal.
I have checked out PayPals button features which they allow and you can only set a given price for the user to pay for when you create the button.
Is there a way I can link the PayPal button to my database so it shows the total of all the ItemUnitPrice fields.
The variable which holds the total ItemUnitPrice:
<?php
$Total = $Quantity * $ItemUnitPrice;
?>
The PayPal 'Pay Now' Button:
<html>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="KAMQ5PVWVDYYN">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_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_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</html>
Edit:
Yeah I've done something stupidly wrong!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="info#asianweddingservices.org" />
<input type="hidden" name="item_name" value="<? $ItemDesc ?>" />
<input type="hidden" name="item_number" value="<?$ItemCode ?>" />
<input type="hidden" name="amount" value="<?$Total ?>" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input src="paypal/purchase.png" name="Submit" type="image" value="purchase" alt="Purchase" />
</form>
Yes. Change the set value to your total.
Show your code and I can edit the answer to fix it for you.
Add this:
<input type="hidden" name="amount" value="<? echo $Total; ?>" />
If that doesn't work:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="PAYPAL EMAIL" />
<input type="hidden" name="item_name" value="ITEM NAME" />
<input type="hidden" name="custom" value="CUSTOM VALUE" />
<input type="hidden" name="item_number" value="ITEM NUMBER" />
<input type="hidden" name="amount" value="TOTAL" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input src="paypal/purchase.png" name="Submit" type="image" value="pruchase" alt="Purchase" />
</form>
Replacing the values to yours of-course.

Categories