Paypal subscription intergration - paypal

I am currently trying to integrate paypal into my CMS for subscription, but I can't find anything useful after adding the paypal button to my site. Can anyone recommend where I can go from here or a guide I can use?
Paypals documentation is absolutely rubbish
<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="2354H7J8CK88E">
<table style="margin:0 auto 15px;">
<tr><td><input type="hidden" name="on0" value="Account Types">Account Types</td></tr><tr><td><select name="os0">
<option value="Basic">Basic : £14.99 GBP - monthly</option>
<option value="Plus">Plus : £29.99 GBP - monthly</option>
<option value="Pro">Pro : £44.99 GBP - monthly</option>
<option value="Business">Business : £59.99 GBP - monthly</option>
<option value="Unlimited">Unlimited : £79.99 GBP - monthly</option>
</select> </td></tr>
</table>
<input name="companyid" type="hidden" value="<?php echo getCompanyID(); ?>"/>
<input type="hidden" name="currency_code" value="GBP">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/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_GB/i/scr/pixel.gif" width="1" height="1">
</form>

Set up a PayPal 'sandbox' account. And look at the docs here https://developer.paypal.com/docs/classic/products/instant-payment-notification/ . There are code samples available for IPN (Instant Payment Notification).
Using the sandbox is great, since you can test your processes without spending any real money. (Although you will spend 'real time'.)>
There are also several tutorials; one is here http://www.codexworld.com/paypal-standard-payment-gateway-integration-php/ .
Good luck!

Related

Paypal Live Subscription : Invalid Regular period. You must specify valid values for the A3, P3, and T3 parameters for a subscription

I made a subscription button in sandbox which is working perfectly. But when I make a button in live, it throws the below error
Invalid Regular period. You must specify valid values for the A3, P3, and T3 parameters for a subscription.
My Sandbox Code:
<form action="https://www.sandbox.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="FPHQZ37TC27R2">
<input type='hidden' name='rm' value='2'>
<table>
<tr><td><input type="hidden" name="on0" value="VaccineXpress Subscription">VaccineXpress Subscription</td></tr><tr><td><select name="os0">
<option value="1 Provider : $59.00 USD - monthly">1 Provider : $59.00 USD - monthly : $59.00 USD - monthly</option>
<option value="1 Additional Provider : $68.00 USD - monthly">1 Additional Provider : $68.00 USD - monthly : $68.00 USD - monthly</option>
<option value="2 Additional Providers : $77.00 USD - monthly">2 Additional Providers : $77.00 USD - monthly : $77.00 USD - monthly</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
My Live 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="FD2ZRKMF3EPDC">
<input type='hidden' name='rm' value='2'>
<table>
<tr><td><input type="hidden" name="on0" value="VaccineXpress Subscription">VaccineXpress Subscription</td></tr><tr><td><select name="os0">
<option value="1 Provider : $59.00 USD â monthly">1 Provider : $59.00 USD â monthly : $1.00 USD - monthly</option>
<option value="1 Additional Provider : $68.00 USD â monthly">1 Additional Provider : $68.00 USD â monthly : $68.00 USD - monthly</option>
<option value="2 Additional Providers : $77.00 USD â monthly">2 Additional Providers : $77.00 USD â monthly : $77.00 USD - monthly</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<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>
I made the button from create button section. I set the return url from selling tools as well. Please tell where I am making mistake in live. There is not any a3, p3 & t3 in sandbox or live code.
Do I have to do any Payment / Account setup for the same.
Do I have to do "Link your bank account" from Account Setup.
Pleas guide on the same.
These three variables define the terms of your subscription. What you have built is basically a Buy now button, because there is no mechanism to collect future payments.
<input type="hidden" name="a3" value="0.01">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
This translates to $0.01 billed every month. In a hosted, or saved button, these variables are not visible in the source code.
Also, subscription buttons don't support drop down menus. In your use case you would need to create a separate button for each of the options in the drop down.

Paypal return url is giving blank array

<form id="dvrr" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<table border="0" cellpadding="5" cellspacing="5" align="center" width="100%">
<tr>
<td></td>
<td><input type="hidden" name="business" value="ceo#world-airport-city-transfer.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="Cab Booking">
<input type="hidden" name="item_number" value="<?php echo $orderid; ?>">
<input type="hidden" name="amount" value="<?php echo number_format((float)$data['price'], 2, '.', ''); ?>">
<input type="hidden" name="currency_code" value="USD">
<!-- Specify URLs -->
<input type="hidden" name="cancel_return" value="http://www.wer.com/payment-cancel/">
<input type="hidden" name="return" value="http://www.wer.com/payment-processing/">
<input type="hidden" name="notify_url" value="http://www.wer.com/notify-payment/">
<!-- 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">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" ></td>
</tr>
</table>
This is my PayPal form that I'm using for payment, on thank you page we add the code to get the response and update it on our system that the transaction is complete or not.
we place this code on weburl.com/payment-processing/ that is our return URL
$data=$_POST;
if($_POST['payment_status']!=''){
$item_name=$_POST['item_name'];
$item_number=$_POST['item_number'];
$txn_id=$_POST['txn_id'];
$payer_email=$_POST['payer_email'];
$payment_gross=$_POST['payment_gross'];
$payment_status=$_POST['payment_status'];
$insert = mysql_query("INSERT INTO cr_payments(item_name,item_number,txn_id,payer_email,payment_gross,payment_status) VALUES('".$item_name."','".$item_number."','".$txn_id."','".$payer_email."','".$payment_gross."','".$payment_status."')") or die(mysql_error());
global $wpdb;
$is_added = $wpdb->query("UPDATE cr_booking SET fld_booking_status = '$payment_status' WHERE fld_booking_id = '$item_number'");
but we get data when we run code on sandbox mode .. but on live mode we are getting blank array
PayPal website payments standard, including the PayPal button you use, do NOT carry anything back to your return URL.
You will have to store data in your shopping cart before jumping to PayPal payment page.
Another PayPal product you can use, which is very different from the one you are using, is express checkout. It requires you to program the API calls between your server and PayPal, but the actual charge is done by calling doexoresscheckout on your server, so you can decide what to display according to the result of this API call.
i resolve the issue by my custom way i just write the ipn data on a file by file_put_content and convert file data in to array and by twice exploding it by & and = i got the exact data after it on that bases we process the payment data in our website

I am trying to redirect to paypal from my site http:\\www.abc.com and it doesn't work

I am trying to redirect to paypal from my site http:\www.abc.com and it doesn't work and shows message like To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
Anyone can tell what is this issue for?
Here is a code example directly from the PayPal Developer Site:
For PayPal Button Manager API Overview click here
<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="19218">
<table>
<tr><td><input type="hidden" name="on0" value="Color">Color</td></tr><tr><td><select name="os0">
<option value="Red">Red $10.00
<option value="Blue">Blue $8.00
<option value="Green">Green $12.00
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Size">Size</td></tr><tr><td><select name="os1">
<option value="Small">Small
<option value="Large">Large
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

choose amount from dropdown list - paypal

I used the following code for my Donate button. When I choose amount in dropdown list and click Donate. It redirects to paypal site and asking me to enter the amount again but I already chosen amount in the dropdown list. Any help is appreciated. thanks.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<select name="amount" id="amount">
<option value="10">10 SEK</option>
<option value="20">20 SEK</option>
<option value="30">30 SEK</option>
<option value="40">40 SEK</option>
<option value="50">50 SEK</option>
</select>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxxxxxx">
<input type="hidden" name="currency_code" id="currency_code" value="SEK">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_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>
When using hosted PayPal buttons you'll need to configure the drop down options in the button creation wizard. If you want to include all of that on your own you'll need to use non-hosted buttons.

Cannot get Paypal subscribe button to work

I am trying to implement a simple subscribe button using Paypal.
I have used their button generator and then copy pasted that code into my webpage.
The form looks perfectly fine and when I select a package and then click subscribe I need to login to Paypal which also works but then I get this error:
The link you used to access the PayPal system is invalid. Check the link and try again.
This is my button code. What is wrong?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXX">
<table>
<tr><td><input type="hidden" name="on0" value="Packages">Packages</td></tr><tr><td><select name="os0">
<option value="Donor">Donor: $5,00 USD</option>
<option value="Vip">Vip: $10,00 USD</option>
<option value="Svip">Svip: $15,00 USD</option>
<option value="Elite">Elite: $20,00 USD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Minecraft username">Minecraft username</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/sv_SE/i/scr/pixel.gif" width="1" height="1">
</form>
Forgot to fill in all settings for my Paypal Company account. Works fine now with above code.