HTML Variables for Recurring Payments Buttons with a modifier - paypal

I'm looking to add a modifier to my PayPal Subscription button. I'd like to modify the subscription cost depending upon how many users the customer enters. Essentially, the subscribe button has a "base cost", with +$xx.xx added to the monthly subscription cost.
For example:
A user wants to create an account on my app with 6 users at $5 per user with a base subscription cost of $10/mo. The monthly cost of that subscription would be $40.

This can be achieved(may not be the most optimal solution)
Go to PayPal button designer
Moreover you are an advanced user in PayPal, you can customize checkout pages for your customers, streamline checkout, and more in this section.

I needed to build the markup as such. Then, using JavaScript I was able to assign the .val() of the item_number, item_name, and a3 fields. Works great!
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top" style="display: inline-block">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="...">
<!-- Specify a Subscribe button. -->
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<!-- Identify the subscription. -->
<input type="hidden" name="item_number" monthly_item_name>
<input type="hidden" name="item_name" monthly_item_name>
<!-- Set the terms of the regular subscription. -->
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" id="monthly">
<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">
<!-- Send the user back here once they've completed payment. -->
<input type="hidden" name="custom" value="<?php echo $_SESSION[ID]; ?>">
<input type="hidden" name="return" value="...">
<input type="hidden" name="rm" value="2">
<input type="submit" name="submit" class="btn btn-inverse" value="Monthly" 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>

Related

PayPal Not Passing Amount For Donation

I'm building a website for a client that has to take donations. I want to have the donation value passed through and automatically filled when they land on PayPal. I have two different sets of code with two different errors.
I do not have access to my clients PayPal account so please let me know if it's not solvable on my end. I do have their merchant ID, which has been redacted in the below code with "merchantidgoeshere".
Code 1: Goes To Merchant Donation Form But Doesn't Pass The Value
<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="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
Code 2: Doesn't Go To Page And Redirects To Error Page With The Message:
We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
The first button is a hosted button, so the amount details would have to be set at in the button wizard within the PayPal account. You won't be able to pass your own dynamic value using a hosted button.
The second one is working fine for me when I replace "merchantidnumberhere" with a valid account email address. Did you make sure to update the business parameter with a valid email address or account ID?
Just as a note, to force English as the language the code shouldn't be:
<input type="hidden" name="lc" value="US">
It should be:
<input type="hidden" name="lc" value="en_US">
Cheers from Spain!

PayPal custom button with dynamic price

I have a website that offers a service where the price changes dynamically. For instance there are radio buttons and checkboxes that make the final price variate. At the final stage I have an hidden input that contains the final price.
How do I tell PayPal that that is the price to charge? I have tried to follow the documentations on PayPal website but I can't find an answer for this.
How could I dynamically change the values of these inputs but also make sure it's safe?
<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="herschelgomez#xyzzyu.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="5.95">
<input type="hidden" name="currency_code" value="USD">
<!-- Prompt buyers to enter their desired quantities. -->
<input type="hidden" name="undefined_quantity" value="1">
<!-- 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" >
</form>
Any help would be much appreciated, I'm really stuck on this.
Thanks,
Jeff

Paypal Return URL

I need to allow recurring subscription to take place. So far, It is looking good except that Paypal is not honoring completely the "return" hidden variable value. It does the redirect but it omits the supplied query string. It does add couple querystring variables such as www.mysite.com?auth=XXXX&form_charset=YYYY
For my solution, I want to rely on some values on the query string if that possible. Otherwise, I would have to store that temporary info in Session.
Any ideas?
<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="MerchantEmailAddress" />
<input type="hidden" name="item_name" value="Description of Transaction">
<input type="hidden" name="a3" value="5.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="custom" value="111.111111" />
<input type="hidden" name="invoice" value="11" />
<input type="hidden" name="cancel_return" value="http://www.MySite.com/?Cmd=Cancel" />
<input type="hidden" name="return" value="http://www.MySite.com/?Cmd=Return" />
<input name="notify_url" value="http://www.MySite.com/?Cmd=Notify" type="hidden">
<!-- 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">
</form>
Adding the rm=2 variable and value should work. That would tell PayPal to send information back as a POST. If you have Payment Data Transfer enabled in your seller account it would overwrite the rm value and the information returned to your site from PayPal would always be a GET.

PayPal Payments Standard custom HTML form; How does PayPal know who is submitting?

I'm trying to get this form to initiate a donation using PayPal Payments Standard...
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="text" name="amount"></input>
<input type="hidden" name="item_name" value="OrganizationXYZ Donation">
<input type="hidden" name="image_url" value="http://www.OrganizationXYZ.org/images/logo.gif">
<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">
</form>
This seems like it should work according to PayPal's documentation, but it doesn't. Instead I get this error:
"We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com."
This error doesn't make any sense because you do not supply an email address in these forms. Yet it seems to me that my form needs to post some kind of identification- otherwise how would PayPal know which account is receiving the donation? Unless I register a domain vai my PayPal account settings, but there is no place to do that either.
Does anybody have experience with setting this up?
Yes, as you mentioned, it need some sort of identifier of the recipient.
What you need to add is the 'business' parameter. That's all.
<input type="hidden" name="business" value="your secure merchant account ID / email here">
You must to have a merchant account.
You can see a tutorial here: http://kb.worldsecuresystems.com/833/cpsid_83331.html
try this code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<select name="amount">
<option value="3.99">6 Months ($3.99)</option>
<option value="5.99">12 Months ($5.99)</option>
</select>
<br>
<input name="currency_code" type="hidden" value="USD">
<input name="shipping" type="hidden" value="0.00">
<input name="tax" type="hidden" value="0.00">
<input name="return" type="hidden" value="urlOnValidPayment">
<input name="cancel_return" type="hidden" value="UrlOnCancelPayment">
<input name="notify_url" type="hidden" value="URLForValidationPayement">
<input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="your e-mail">
<input name="item_name" type="hidden" value="name of the object">
<input name="no_note" type="hidden" value="1">
<input type="hidden" name="no_shipping" value="1">
<input name="lc" type="hidden" value="EN">
<input name="bn" type="hidden" value="PP-BuyNowBF">
<input name="custom" type="hidden" value="custom data">
<input type="image" src="https://www.paypalobjects.com/en_US/CH/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/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
for me it's work
¿Are you just generating the payment buton yourself?
I must recommend you to login to your PayPal account, go to this part of the menu:
Merchant Services -> Key Features -> Buy now Button
Then choose the button type I guess you want a Donate button.
Then configure the overall button settings, I must recommend to save the button in paypal servers.
Finally choose Create Button
This will give you the right HTML code. This is a sample donate button HTML.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="YOUR_BUSINESS_ID">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="myorgname">
<input type="hidden" name="item_number" value="donateid">
<input type="hidden" name="amount" value="20">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
<input type="hidden" name="custom_variable1" value="val1">
<input type="hidden" name="custom_variable2" value="val2">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_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>
Here is your problem:
<input type="hidden" name="cmd" value="_donations">
Paypal's image value in Encrypted Payment System (WPS - EPS) for "cmd" is "_s-xclick"
So use it as below:
<input type="hidden" name="cmd" value="_s-xclick">

Paypal no-shipping variable not working

I'm having some trouble implementing PayPal into a website. I haven't used it in a while and a lot of things have changed since.
The problem I'm having is that i specified clearly that users should not be prompted for their shipping address, however, when the "no paypal account" option is selected, the shipping info is anyways asked.
I know I should ask PayPal, but here people are smarter and kinder. =)
code:
note the: <input type="hidden" name="no_shipping" value="1">
<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="ventas#ziced.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Variables agregadas -->
<input type="hidden" name="notify_url" value="notify.php">
<input type="hidden" name="return" value="return.php">
<input type="hidden" name="cancel_return" value="cancel_return.php">
<input type="hidden" name="page_style" value="primary">
<input type="hidden" name="lc" value="EN">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Ziced id:">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="quantity" value="1">
<!-- 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>
no_shipping=1 applies to the shipping address. What you're looking at for the buyer on the 'guest checkout form' is the billing address. That's always going to be required.
Here's a little more information for others:
<input type="hidden" name="no_shipping" value="0"> - prompt for shipping address, but do not require one
<input type="hidden" name="no_shipping" value="1"> - do not prompt for shipping address
<input type="hidden" name="no_shipping" value="2"> - prompt for shipping address, and require one
See also: Paypal Address Handling Guide