How to add extra fields in Paypal subscription click method? - php

Here is my code. I need to add some extra variables example: license-type:Basic
<form 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="business#email.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" >
How to add extra field in this methods ? or I need next line in description tab.!!

This is an example
https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_options_help_outside
Add this:
<input type="hidden" name="custom_input" value="Custom value" />

Please add this:
<input type="hidden" name="custom" value="your custom value">

this is an answer..!!!
<input type="hidden" name="item_name" value="INDIANJOBTIPS">
<input type="hidden" name="on0" value="Duration">
<input type="hidden" name="os0 " value="1 year">
<input type="hidden" name="on1" value="No of users">
<input type="hidden" name="os1 " value="1">

Related

PayPal Subscription for Recurring Payments in php

I'm using following code to make a Payment Subscription.
$paypalURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; //Test PayPal API URL
$paypalID = ''; //Business Email
$usermail = $idarray->email;
<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-subscriptions">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value=Elearning - Kurs">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="lc" value="IN">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="a3" value="1">
<input type="hidden" name="p3" value="12">
<input type="hidden" name="t3" value="M">
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='https://contao.netz-garage.de/fehlgeschlagen.html'>
<input type='hidden' name='return' value='http://contao.netz-garage.de/erfolgreich.html'>
<input type='hidden' name='notify_url' value='https://contao.netz-garage.de/ipn.php'>
<!-- Display the payment button. -->
<input type="submit" name="submit" value="submitted">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form><br><br>
I get to the confirm Site but after that I get to the following site:
failed

Paypal purchase details page with empty fields

I have a standard Paypal button like this:
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="info#mywebsite.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_1" value="My item Name 1">
<input type="hidden" name="amount_1" value="1000">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="item_name_2" value="My item Name 2">
<input type="hidden" name="amount_2" value="20">
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="notify_url" value="http://www.mywebsite.com/ipn-settings">
<input type="hidden" name="return" value="http://www.mywebsite.com/DEV/grazie/">
<input type="hidden" name="custom" value="24">
<!-- Display the payment button. -->
<input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal è il metodo rapido e sicuro per pagare e farsi pagare online.">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
On click it redirects me to the PayPal page but the description and the price field are empty. Only the quantity is set to 1 and is readonly. Is there something wrong with this button?
Thanks in advance for your help.
I had to change the cmd value to "_cart" and add the hidden input "upload" with value = 1
Now it works fine!

Paypal Multiple subscriptions Sample code

i have a website which sells several digital subscriptions (monthly, yearly).
Users may subscribe to many subscriptions and add them to his basket.
i am trying to implement payments of this basket using Paypal.
i succeded making things work for a single subscription but not for multiple subcriptions.
does anyone has a working sample code for multiple subscriptions ?
thanks a lot.
Dan
You can create your own code from this site:
PayPal Developer Standard Subscription Guide
If you would prefer you can get code example for Express Checkout as well from the PayPal Wizard. PayPal Wizard Code Examples
Here is another option for you. Here is a basic code example for a PayPal Subscription Button with drop down menus:
<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="youremail#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sample Subscription Button">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="src" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
<table>
<tr><td><input type="hidden" name="on0" value="Multiple Options">Multiple Options</td> </tr><tr><td><select name="os0">
<option value="Example Monthly">Example Monthly : $20.00 USD - monthly</option>
<option value="Example Daily">Example Daily : $5.00 USD - daily</option>
<option value="Example Annual">Example Annual : $125.00 USD - yearly</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="Example Monthly">
<input type="hidden" name="option_amount0" value="20.00">
<input type="hidden" name="option_period0" value="M">
<input type="hidden" name="option_frequency0" value="1">
<input type="hidden" name="option_select1" value="Example Daily">
<input type="hidden" name="option_amount1" value="5.00">
<input type="hidden" name="option_period1" value="D">
<input type="hidden" name="option_frequency1" value="1">
<input type="hidden" name="option_select2" value="Example Annual">
<input type="hidden" name="option_amount2" value="125.00">
<input type="hidden" name="option_period2" value="Y">
<input type="hidden" name="option_frequency2" value="1">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btnbtn_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 is an example of an open source code button.

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.

Multiple Custom field in paypal notify url form

Paypal have CUSTOM param in its API... I want multi-dimension array pass in CUSTOM field...
<form id="paypal_form" action="https://sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="user#paypal.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="amount" value="10">
<input type="hidden" name="currency_code" value="USD">
<!-- Prompt buyers to enter their desired quantities. -->
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="notify_url" value="http://www.myurl.com" />
<!-- 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" />
<input type="hidden" value="1" name="custom[]" />
<input type="hidden" value="11" name="custom[]" />
</form>
its working fine with single custom field but multi custom field is not working...
you should pass all values like 1,2,3,4,5,6....
return url you will get custom string and convert it to array of string

Categories