I am setting up a donation page (in WordPress) for a non-profit that has a "5 YEAR DONATION PLAN". Members pay $100 per month for 72 months.
I am attempting to use PayPal's example for recurring payments:
<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="alice#mystore.com">
<!-- Specify a Subscribe button. -->
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<!-- Identify the subscription. -->
<input type="hidden" name="item_name" value="Alice's Monthly Digest">
<input type="hidden" name="item_number" value="DIG Weekly">
<!-- Set the terms of the recurring payments. -->
<input type="hidden" name="a3" value="69.95">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<!-- Set recurring payments to stop after 6 billing cycles. -->
<input type="hidden" name="src" value="1">
<input type="hidden" name="srt" value="6">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_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" >
Here is my code, edited:
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="kcarson#basinwidefoundation.com">
<!-- Specify a Subscribe button. -->
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<!-- Identify the subscription. -->
<input type="hidden" name="item_name" value="Sky's The Limit - Galaxy72">
<input type="hidden" name="item_number" value="STL-G72">
<!-- Set the terms of the recurring payments. -->
<input type="hidden" name="a3" value="100.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<!-- Set recurring payments to stop after 72 billing cycles. -->
<input type="hidden" name="src" value="1">
<input type="hidden" name="srt" value="72">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_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" >
If I use the PayPal example, as is, the PayPal page displays exactly as it should. However, when I edit the code, with our specifics, I get this error message:
"The link you have used to enter the PayPal system is invalid. Please review the link and try again."
Thanks for your help!
You are passing the srt=72 which is not allowed . The allowed values for the srt is form 0 - 52 . Here is what docs say :
srt :Optional Recurring times. Number of times that subscription payments recur. Specify an integer with a minimum value of 2 and a maximum value of 52. Valid only if you specify src="1".
You can refer the documentation here.
Once you set it to any value between 0- 52 , it should work fine .
Related
I have a Paypal account with set subscription button on it. After a subscription is set by a buyer I am sending him to a receipt page. On this page I need to retrieve variables from Paypal to update by database.
form is working
subscription saved on Paypal
buyer correctly redirected to receipt page
but variable are not retrieved.
here is what I have tried so far:
<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="mybusinessname">
<input type="hidden" name="lc" value="IE">
<input type="hidden" name="item_name" value="Monthly Subscription">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="a1" value="0.00">
<input type="hidden" name="p1" value="1">
<input type="hidden" name="t1" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="1.50">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="test_value">
<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>
Instant Payment Notification (IPN) details on Paypal are enabled and point to:
https://www.mydomain/payments/
IPN history shows that notifications from Paypal are correctly sent to Notification URL (above)
However, the receipt page shows
Error
Undefined index: custom
to get the custom variable I tried GET, POST and even REQUEST method using something like
test 1: <?php echo $_GET["custom"]; ?>
test 2: <?php echo $_POST["custom"]; ?>
Then I tried
<?php
if (isset($_POST['custom'])) {
$custom_display = $_POST['custom'];
}
?>
but this results in: Undefined variable: custom_display
All I need is to get custom variable.
I am guessing that I am doing something wrong, but after many hours of searching for an answer and trying different settings (e.g. sending dynamically notification url within the form, changing settings in paypal, using different urls etc) nothing seems to be working for me and I am stuck
Any help would be greatly appreciated!
I ran into the same issue (?) a few months back. The answer seems to be: PayPal does not pass custom in IPN anymore (nor does it honor the return value). Both of these stopped working sometime last year.
My workaround was to use the subscr_id value to lookup the customer profile. YMMV.
I have some code that i wrote many years ago to integrate Paypal within my site. So a user adds multiple products to their cart and then checks out which then automatically takes the user to the paypal site.
I decided to revisit it today and created the following HTML
<form name="myForm" method="POST" action="https://www.sandbox.paypal.com/cgi-bin/webscr" >
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="business" value="myemail-facilitator#myDomain.com"/>
<input type="hidden" name="item_name" value="Product 1"/>
<input type="hidden" name="amount" value="500.00"/>
<input type="hidden" name="quantity" value="1"/>
<input type="hidden" name="upload" value="1"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="hidden" name="return" value="http://XX/paypal/completed.aspx"/>
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cancel_return" value="http://XX/paypal/Cancel.aspx"/>
<input type="hidden" name="shopping_url" value="http://XX/paypal/MyShop"/>
<input type="hidden" name="notify_url" value="http://XX/paypal/MyShop/checkout.aspx"/>
<input type="hidden" name="lc" value="GB"/>
<input type="hidden" name="image_url" value="http://XX/paypal/shop.gif"/>
<input type="hidden" name="no_note" value="1"/>
<input type="hidden" name="invoice" value="ZZZ1234567890"/>
<script type="text/javascript">document.myForm.submit();</script></form>
This came up with an error "Error Detected Your shopping cart is empty".
Logged into my sandbox account and no error listed to determine what ive done wrong.
Googled around which suggested to change _cart to _xclick - which resolved the issue, however when i read the documentation at
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
I dont understand why _cart didnt work? Is there a more appropriate way to do this or _xclick fine with my site setup as described above?
For multiple items i was looping the item_name and amount and adding each value, but this doesnt work the way i expected i.e. I've seen sites where they display each product, quantity and amount for each product in the cart and then total - where did i go wrong?
Finally once a transaction is complete i have set up the IPN value to send the details to my site..... Do i need the site to be using https in order for this to work or would http work?
I tried searching for these answers but some are quite dated or using 3rd part components.
Please make below changes to your HTML codes to make your form work again.
<input type="hidden" name="item_name" value="Product 1"/>
<input type="hidden" name="amount" value="500.00"/>
<input type="hidden" name="quantity" value="1"/>
↓↓
<input type="hidden" name="item_name_1" value="Product 1"/>
<input type="hidden" name="amount_1" value="500.00"/>
<input type="hidden" name="quantity_1" value="1"/>
So I'm trying to implement a PayPal payment field on my Wordpress site that has two custom fields where users can type in.
One, being invoice number
Two, being the price.
I found some code (untested) from another post here on stackoverflow, that is working as of 2013 (last post of the thread).
Passing price variable to PayPal with custom button
It has a text box where users can type in their custom price, and it gets passed to PayPal. I need to edit the form to allow the invoice number passing too. Does anyone have any idea how to do this? Never used PayPal API before. All help is greatly appreciated, thanks!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="XXXXXXXX">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Payments">
<input type="hidden" name="amount" value="100.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<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="http://YOURSITE.com/">
<input type="hidden" name="cancel_return" value="http://YOURSITE.com/payments.html">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<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 ended up working it out.
I had to change type="hidden" for the item_name to type="text".
Very simple fix, wasn't expecting it to be this easy!
I want payment in paypal with dynamic price entered into textbox in wordpress. can anyone help me?according to user choices and price rate list,total price will change and will be calaulated by user.user will enter that amount in textbox which will be paid in paypal.How to do this? I did research on it.
You could use code similar to the following, where you have a text box for the buyer to enter in the amount. Then they click the button to make a payment and they will be redirected over to PayPal with that amount.
<form target="paypal" 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="my_site#my_site.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="Hot Sauce-12 oz. Bottle">
<input type="hidden" name="currency_code" value="USD">
<input type="text" name="amount" maxlength="60">
<br />
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
</form>
What I want to do is to have a PayPal subscription button on my website, with a quarterly rebilling option.
I know there is a way to do this with non-hosted button code, but I am wondering if there is any way to implement this using PayPal hosted subscription buttons (for security). I'd like to avoid having to use an unhosted button code with encryption and all the script work that entails.
Paypal has an Advanced Subscription Button that integrates a few additional hidden fields to customize the billing period and frequency.
Sample Code
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="a3" value="50.00">
<input type="hidden" name="p3" value="3">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
</form>
The above code will create a recurring payment of $50.00 every 3 months (quarterly). The following fields affect the billing amount, period and frequency.
a3 - amount to billed each recurrence
p3 - number of time periods between each recurrence
t3 - time period (D=days, W=weeks, M=months, Y=years)