This is not a duplicate of this post.
I quote from the linked post:
As of June 29, 2017 I see this not working. Paypal has again changed its rules, and I don't think it any longer accepts hidden HTML fields in the form submission: they must be set in the button editor at Paypal.
Paypal documentation is a mess. Half of the links are broken and the other half of the links point to the documentation index.
Does any brain out there know how to achieve a Paypal Payment Button where I can set the price dynamically?
PayPal recommended to use Express checkout client side integration and you can send the amount dynamically from your website to PayPal code.
Refer the following links for PayPal Express checkout client side integration:
https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/client-side-REST-integration/
https://developer.paypal.com/demo/checkout/#/pattern/client
Otheriwse, please try with the below PayPal HTML button code.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="Yourbusinessemail#paypal.com"> <!-- Add your PayPal Seller/Business email address Required-->
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value=""> <!-- Add Description e.g your room type Required-->
<input type="hidden" name="amount" value=""> <!-- Dynamically add Total Amount Required-->
<input type="hidden" name="currency_code" value=""> <!-- Update to your currency -->
<input id="invoice" type="hidden" value="" name="invoice"> <!-- Add Unique invoice for each transaction -->
<input type="hidden" name="notify_url" value="www.yourwebsite.com/ipn.php"> <!-- Please add IPN URL You can use this service to automate back-office and administrative functions, including fulfilling orders, tracking customers, and providing status and other information related to transactions. -->
<input type='hidden' name='cancel_return' value='' /> <!-- Take customers to this URL when they cancel their checkout -->
<input type='hidden' name='return' value='' /> <!-- Take customers to this URL when they finish their checkout -->
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
</form>
HTML Variables - https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Buy Now button - https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/buy_now_step_1/
IPN - https://developer.paypal.com/docs/classic/ipn/gs_IPN/
IPN - https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/
IPN Sample: https://github.com/paypal/ipn-code-samples
<form name="_xclick" method="post" action= "https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="xxx#jjdj.com">
<input type="hidden" name="item_name" value="XXXX">
<input type="hidden" name="notify_url" value="http://XXXXXXX.com/ipn.php" />
<input type="hidden" id="buybuttonid" name="custom" value="XXXXX" />
<input type="hidden" name="amount" value="amount that you want to send">
<input type="submit" value="Buy Now">
</form>
Please use this button and don't pass the item number and quantity then it will not set amount dynamically.
Just create simple buy now button and make price/amount value blank at time of creation of button
Related
I have this paypal button:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="myPayPalAccount#gmail.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="item-to-buy">
<input type="hidden" name="amount" value="5">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="mywordpressblog.com/return-url/">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Pay Now">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
How can I get all the payment details in my return url (mywordpressblog.com/return-url/) which is a custom WordPress page?
I need at least to know if payment was successful or not and display a consequent message and make an update on the database.
Thanks in advance for your suggestions.
mywordpressblog.com/return-url/ --> only redirect to page successful so if you check detail payment after done can use IPN Paypal.
Document Dev on Paypal or other search
My paypal payment completed successfully but after payment,I don't get transaction detail like transaction id, currency, price, item,receipt no etc...
before 15 days its working properly. but now its not working.
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-
bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="kin#kinskards.com">
<!-- Specify a PayPal Shopping Cart Add to Cart button. -->
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Birthday - Cake and
Candle">
<input type="hidden" name="amount" value="3.95">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="cancel_return"
value="http://localhost/PayPalDemo/PayPalDemoCancel.php">
<input type="hidden" name="return"
value="http://localhost/PayPalDemo/PayPalDemo/Succes.php">
<!-- Display the payment button. -->
<input type="image" name="submit"
src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_addtocart_120x26.png"
alt="Add to Cart">
<img alt="" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif">
</form>
You must pass notify_url parameter like cancel_return.
<input type="hidden" name="notify_url" value="http://localhost/PayPalDemo/PayPalDemoPayment.php" />
Also you must set this URL in sandbox account in IPN section. Refer this https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/
i have following problem.
I integrated Paypal to my website. Now I want to test the PayPal settings. I test it in the sandbox enviroment. So the paying is working very well and after the payment the site redirects to my success.php site.
and there i have a problem.
Normaly it should show something like mywebsite.de/success.php?tx=83437E384950D&st=Completed&amt=10.00&cc=USD&cm=&item_number=1
but it only shows
mywebsite.de/success.php
my code looks like this
paypalURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; //Test PayPal API URL
$paypalID = 'mywebsite#site.de'; //Business Email
<center><form action="<?php echo $paypalURL; ?>" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo $paypalID; ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="1 Monat Premium Mitgliedschaft">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="49.99">
<input type="hidden" name="currency_code" value="EUR">
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='http://mywebsite.de/index.php'>
<input type='hidden' name='return' id='return' value='http://mywebsite.de/success.php/'>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynowCC_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form></center>
What did I wrong hand how do i get the invformation of paypal for my success page??
Pass the rm variable with value as 2, refer the below:
<input type="hidden" name="rm" value="2">
Once you pass rm=2 then you will see the below variables after the buyer redirect to your website:
http://mywebsite.de/success.php/?amt=10.84&cc=USD&item_name=XXXXX&st=Completed&tx=XXXXXXX
I am using PayPal Standard HTML form, and after the user has completed the transaction he/she is taken to the return url. I want to be able to identify the user email, the order number, and other information that may be available using php. In other words, I want to use the GET method to retrieve the variables in the URL
This is a recurring payment (subscription), and below is the html code.
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="info#merchant.com">
<input type="hidden" name="return" value="test">
<!-- Specify a Subscribe button. -->
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<!-- Identify the subscription. -->
<input id="paymentName" type="hidden" name="item_name" value="test">
<input type="hidden" name="item_number" value="1234">
<!-- Set the terms of the regular subscription. -->
<input type="hidden" name="currency_code" value="CAD">
<input id="paymentPrice" type="hidden" name="a3" value="0.01">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<!-- Set recurring payments until canceled. -->
<input type="hidden" name="src" value="1">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" style="width:240px; border: none; height:50px"
src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png"
alt="PayPal - The safer, easier way to pay online">
</form>
As others already commented. You should use Instant Payment Notification (IPN).
documentation
Basically you need to set in your html form a field called "notifyurl", something like this:
<input type="hidden" name="notifyurl"alue="http://www.example.com/ipn_listener.php">
For the ipn_listener.php you have sample code here (if PHP):
Sample code for PHP
If you need to attach some specif information to the payment you can also use the paremeter "custom", and read it back in you ipn listener.
I want to create dynamic billing button using paypal
when I used create button at the paypal.com it generate a button for me :
<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='BFKATLSGW6CTW'>
<input type='image' src='https://www.paypalobjects.com/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.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>
but it's with a static price
I tried to add a hidden input
<input type="hidden" name="amount" value="5.95">
but the price still static
I tried the automatic billing throw the paypal.com
but I got
You need to have a PayPal Business account and the Enhanced Recurring Payments package to create Automatic Billing or Installment Plan buttons
I viewd my profile and created a business app for it , but the message still the same
My last try to use this form
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can bill for payments. -->
<input type="hidden" name="business" value="BLWHUxxxxxx"> <!-- I put my merchant id---->
<!-- Specify an Automatic Billing button. -->
<input type="hidden" name="cmd" value="_xclick-auto-billing">
<!-- Specify details about the automatic billing plan. -->
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Regular House Cleaning">
<input type="hidden" name="max_text" value="Regular House Cleaning">
<input type="hidden" name="set_customer_limit" value="max_limit_own">
<input type="hidden" name="min_amount" value="1.00">
<!-- Make sure you get the buyer's address during checkout. -- >
<input type="hidden" name="no_shipping" value="2">
<!-- Display the description and a text box to enter the maximum. -->
<table>
<tr>
<td><strong> </strong></td></tr>
<tr><td>
</td></tr>
<tr><td>$
<input type="hidden" name="amount" value="5.95">
<input type="text" name="max_amount" value="1000"> USD</td></tr>
<!-- Inform buyers of the monthly minimum payment -->
<tr><td> </td></tr>
</table>
<!-- Display the Automatic Billing button -->
<table>
<tr><td><input type="image" border="0" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online!"></td></tr>
</table>
<img alt="" border="0" width="1" height="1" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" />
</form>
but the result is
This merchant is no longer authorized to offer this Autobilling plan.Please contact the merchant or choose another product.
any recommendations to have a script that take the price from the database to let the customer pay for the the services !
You are using Hosted button. It is not possible to over-write the amount value in Hosted Button . You can can clear text button to over-write the amount variable.
When you create a button in Paypal, make sure you uncheck the option "Save button at PayPal" in Step 2 . This makes the button "Clear Text" and provides option to over-write any variable using your custom logic.Automatic billing,Installments button work only if you have Enhanced Recurring Payments ERP