Is there a way to modify the PAYPAL generated button code below to make it dynamic using a php varible? This is the original code:
<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="ZBA2RX3Q8L9V8">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_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>
This is the logic that I am after:
<?PHP $paypal_email=client#website.com; ?>
<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="<?PHP echo $paypal_email ?>">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_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>
THIS IS MORE DYNAMIC-FRIENDLY AND IT WORKED:
<form name="_xclick" action="https://www.paypal.com/ck/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?PHP ech VARIABLE HERE; ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="ITEM NAME">
<input type="hidden" name="amount" value="1.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
THIS IS MORE DYNAMIC-FRIENDLY AND IT WORKED:
<form name="_xclick" action="https://www.paypal.com/ck/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?PHP ech VARIABLE HERE; ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="ITEM NAME">
<input type="hidden" name="amount" value="1.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Related
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>
I have the following form code in my website however when I click on the Paypal subscription button the price of the subscription shows $0.00 on the paypal checkout page. Is there something wrong with my form parameters?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="registrations-facilitator#invent2win.com">
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="a3" value="5.55"> <!--Cost-->
<input type="hidden" name="t3" value="1"> <!--Monthly subscription-->
<input type="hidden" name="p3" value="M"> <!--Monthly subscription-->
<input type="hidden" name="src" value="1"> <!--YES, make it reoccurring-->
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="Economy Sandbox">
<input type="hidden" name="item_number" value="$usernum" />
<input type="hidden" name="return" value="http://www.example.com/purchasecomplete&email=$email?num=$usernum" />
<input type="hidden" name="cancel_return" value="http://www.example.com/cancel" />
<input type="hidden" name="notify_url" value="http://www.example.com/purchasecomplete&email=$email?num=$usernum">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_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>
This should work for you:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="registrations-facilitator#invent2win.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="a3" value="5.55">
<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">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="Economy Sandbox">
<input type="hidden" name="item_number" value="4" />
<input type="hidden" name="return" value="http://www.example.com/purchasecomplete&email=$email?num=$usernum" />
<input type="hidden" name="cancel_return" value="http://www.example.com/cancel" />
<input type="hidden" name="notify_url" value="http://www.example.com/purchasecomplete&email=$email?num=$usernum">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_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>
how to hide paypal button code from user ?
for example codecanyon.net when i purchase some item i don't see paypal form , how can i do that ?
my user will edit price and currency code
i use code look like this.
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="text" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="text" name="amount" value="12.99">
<!-- for submit button -->
<input type="submit" name="submit" value="Pay now">
<!-- for image button -->
<input type="image" src="your button image url" border="0" name="submit" alt="Give here some title">
</form>
For currency you should use select box
<input type="text" name="currency_code" value="USD">
<select name="currency_code" >
<option value="USD">USD</option>
</select>
when you use the button tool to create a saved button all the sensitive data is stored in the account and is replaced by a "Button ID". Here's an example:
<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="L7NSNLBNU69AC">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_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>
Use:
<input type="image" src="your image url" border="0" name="submit" alt="Pay Now">
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">
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