how to use paypal subscription form for multiple subscriptions? - php

I am trying to use paypal subscription form for multiple product, but its not working.
Here is my form which i used.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="archirayan9#gmail.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="item_name" value="Baseball Hat Monthly - test2 " />
<input type="hidden" name="item_number" value="asd">
<input type="hidden" name="a3" value="10.00">
<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">
</form>
This form is for 1 product subscription. I want to make it for multiple products with different item_id.
I cant found any thing that help me to setup multiple product subscription using this form.
Anyone have solution how to do?

Related

How to change currency in PayPal for 3rd-party shopping cart checkout?

I am using this PayPal payment method in my project and I facing one issue in currency.
I have followed this link steps(https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside#methodone) and integrated PayPal, all things working fine but the currency showing wrong on the checkout page but when going to the next page it is showing properly.
I want to change the currency text from USD to EUR on the checkout page. how it is possible.
Can any help with it?
here is code
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="frmTransaction" id="frmTransaction">
<input type="hidden" name="business" value="Email">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="shipping" value="0"/>
<input type="hidden" name="item_number" value="">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cancel_return" value="">
<input type="hidden" name="return" value="">
<input type="hidden" name="notify_url" value="">
</form>
1, Add EUR currency to your Paypal account using this link
like this screenshot
OR
Go to > Account Settings > BUSINESS PROFILE > Money, banks and cards > Currency management
2, Remove these two elements from your form
<input type="hidden" name="rm" value="2">
<input type="hidden" name="upload" value="1">
your final form code like below
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="frmTransaction" id="frmTransaction">
<input type="hidden" name="business" value="web91.siddharth#gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="shipping" value="1"/>
<input type="hidden" name="item_number" value="">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="cancel_return" value="">
<input type="hidden" name="return" value="">
<input type="hidden" name="notify_url" value="">
<input type="submit" value="Pay Now">
</form>

PayPal html button for digital goods

I'm having a problem with a PayPal button that I made. Yesterday I got my first sale of a digital good on my website, everything worked well except at the end when PayPal blocked the payment.
I called them to know why and they explained me that it was because the order was made for physical products and the shipping information was missing.
They unblocked the payment but I can't find how to set that the payment is for digital goods.
My code below:
<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="my email">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="item_name" value="product">
<input type="hidden" name="amount" value="00.00">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="mysite">
<input type="hidden" name="cancel_return" value="mysite">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_SM.gif:NonHosted">
<input type="hidden" name="custom" value="userid" />
<input type="hidden" name="notify_url" value="IPN ">
<input type="image" src="img/paypal1.png" style="width: 100%; height: 100%;" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>
Your code is correct to not collect shipping for a digital good, no_shipping=1. Ref: https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/#paypal-checkout-page-variables
Perhaps you were misinformed as to why the payment was on hold.
One thing you can do is to ensure the item name makes clear that it is something digital.

paypal do not return txn_id in mobile site

I have using paypal in my desktop website and it worked. Below is my code:
<?php
......
echo '<form name="form1" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"><div>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="charset" value="UTF-8">
<input type="hidden" name="cancel_return" value="'.$host.'/my-order-history">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="'.$host.'/payment-done?nid='.$node->nid.'&order='.date("YmdHis",$time).'">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="currency_code" value="HKD">
<input type="hidden" name="handling_cart" value="0.00">
<input type="hidden" name="invoice" value="'.date("YmdHis",$time).'">
<input type="hidden" name="tax_cart" value="0.00">
<input type="hidden" name="business" value="'.$paypal.'">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="amount" value="'.$total_amount.'">
<input type="hidden" name="item_name" value="'.$company_name."-".date("YmdHis",$time).'">
<input id="go_pay" type="submit" name="next" value="confirm" />
</form>';
......
?>
and in payment-done page, I can get the txn_id with $_POST["txn_id"]. But When I use above code in my mobile website, I can pay with paypal by I can't get the txn_id in payment-done page. What can I do to change the code to work in mobile site?
Thank you.
Paypal says the txn_id value is:
The merchant's original transaction identification number for the payment from the buyer, against which the case was registered.
So this seems to imply that if you are not getting a txn_id value back from your transaction, then you're not supplying one to Paypal to use. So this means that you're loosing some data placement in your display flow for transitioning between desktop and mobile display of your website.

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.

submitting multiple items to paypal cart at once with php

I have some items for sale that have 2 and 3 levels of customization. Once set the user adds them to my onsite cart. Problem is, how can i send each item to paypal on checkout? The only code ive found for dynamic buttons supports only a single item.
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="EMAIL">
<input type="hidden" name="item_name" value="Item #1">
<input type="hidden" name="item_number" value="123456">
<input type="hidden" name="amount" value="7.00">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="shipping2" value="0">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
I tried adding
<input type="hidden" name="item_name_2" value="Item #1">
<input type="hidden" name="item_number_2" value="123456">
<input type="hidden" name="amount_2" value="7.00">
But no positive result.
Any ideas?
Here is the solution
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="email#email.com">
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item #2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form>
Why don't you send the total amount your client has to pay to PayPal?

Categories