I have a list of products that I'd like to add a "pay now" button to so that I can allow my customers to pay via Paypal.
I've gone through the documentation and can't find how to do this.
I can add multiple items, but this is not going to be handy as I already have the list of items to process.
I also need the checkout process to itemize the order, so a "buy now" with 1 price is no good either.
Any help appreciated guys, I tried (with no luck):
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="email#domain.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="test 1">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="item_name2" value="test 2">
<input type="hidden" name="item_number2" value="2">
<input type="hidden" name="item_name3" value="test 3">
<input type="hidden" name="item_number3" value="3">
<input type="hidden" name="amount" value="99.00">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
See this sample and make the changes to yours accordingly. Basically add underscore to item name before number and give unique name to amount also with underscore and number.
You have to give amount to each item based on your carts totals.
<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="youremail#mail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name_1" value="beach ball">
<input type="hidden" name="amount_1" value="15">
<input type="hidden" name="item_name_2" value="towel">
<input type="hidden" name="amount_2" value="20">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Specify Quantity(optional)
<input type="hidden" name="quantity_1" value="1">
for more reference about cart: Paypal Cart
it will not work in
<input type="hidden" name="cmd" value="_xclick-subscriptions">
please update me if you know multiple item payment option in recurrent payment method or in any ways i can add tax in this method.
PayPal Add to Cart button helps you to accept payment for multiple items. The button HTML will like the following.
<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="paypal#email.com">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="item_name" value="PHP Book">
<input type="hidden" name="item_number" value="PB123">
<input type="hidden" name="amount" value="25">
<input type="hidden" name="currency_code" value="USD">
<input type='hidden' name='cancel_return' value='http://www.example.com/cancel.php'>
<input type='hidden' name='return' value='http://www.example.com/success.php'>
<input type="image" name="submit"
src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_addtocart_120x26.png"
alt="Add to Cart">
<img alt="" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif">
</form>
Related
I have the following code, which works fine as is. It shows the price at checkout, but I also need it to include a size in the description. How do I add this extra value please?
EDIT: Also, would need to add different shipping costs depending on which size is ordered.
<form id="for-sale-form" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin: 0px;">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="paypal#your-web-domain.com">
<input type="hidden" name="item_name" value="<?php echo $artwork; ?>">
<input type="hidden" name="custom" value="">
<input type="hidden" name="return" value="http://your-web-domain.com/thanks-payment.htm">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="quanity" value="1">
<input type="hidden" name="add" value="1">
<select name="amount">
<option value="499.99">Large £499.99</option>
<option value="49.99">Medium £49.99</option>
<option value="4.99">Small £4.99</option>
</select><br>
<input name="bn" type="hidden" value="PP-BuyNowBF">
<input type="hidden" name="add" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" alt="Add to Cart">
<img alt="" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif">
</form>
I am trying to test a Paypal third-party shopping cart button with a sandbox account. The button looks like this:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top" id="<some_id>">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="<sandbox_account_email>">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="item_number_1" value="item_number_1_value">
<input type="hidden" name="item_name_1" value="item_name_1_value" id="paypal-order-name">
<input type="hidden" name="amount_1" value="10" id="paypal-last-amount">
<input type="hidden" name="item_number_2" value="item_number_2_value">
<input type="hidden" name="item_name_2" value="item_name_2_value">
<input type="hidden" name="amount_2" value="45">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_SM.gif:NonHostedGuest">
<input type="image" id="order-pay-with-paypal" src="/files/1414/1874/7188/checkout-logo-large-de.png" intent="" in-highres-src="/files/9214/1874/7188/checkout-logo-large-de-2x.png" border="0" name="submit" disabled="true">
<input type="hidden" name="return" value="https://somewheretoreturn.com/orders">
<input type="hidden" name="charset" value="utf-8">
</form>
The payment is done successfully, and the redirection occurs, but as a GET method. I need the redirect to my website be a POST. The rm variable is set to 2, as described in documentation, what else do I need to set to do a POST request?
In My Account > Selling online > Website preferences > Auto Return is set to On.
Existing, live (non-localhost) Return URL is provided as well.
PayPal Account Optional is set to Off, as adviced.
Despite that, after finalizing transaction no redirect happens.
My payment button:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="[seller's email]">
<input type="hidden" name="item_name" value="Lorem ipsum">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="currency_code" value="PLN">
<input type="hidden" name="email" value="[buyer's email]">
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/pl_PL/PL/i/btn/btn_paynowCC_LG.gif"
alt="PayPal">
</form>
<form style="float:right" action="https://www.sandbox.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="shivram#gmail.com">
<input type="hidden" name="item_name_1" value="Paper">
<input type="hidden" name="amount_1" value="20">
<input type="hidden" name="shipping" value="3.99">
<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="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<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>
The shipping value is set to 3.99 .It does not add up to the invoice.
JS Fiddle http://jsfiddle.net/34ZfY/ click on the buy now button(the shipping rate does not show up)
Its because it has to be this way:
<input type="hidden" name="shipping_1" value="3.99">
So if you have more products then ..
<input type="hidden" name="shipping_2" value="4.99">
<input type="hidden" name="shipping_3" value="7.99">
And so on..
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="notify_url" value="http://www.blaa.co.uk/ipn_subscribe.asp">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="blaaa#blaa.co.uk">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="http://www.blaablaa.co.uk/thankyou.asp?oid=955">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="item_name" value="Purchase">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="custom" value="955">
<input type="hidden" name="amount" value="85">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="address1" value="5 Birkin Close">
<input type="hidden" name="city" value="knutsford">
<input type="hidden" name="country" value="GB">
<INPUT id="email" type="hidden" name="email" value="test#test.com">
<INPUT type="image" name="Continue" src="NewImages/continue1.jpg" alt="Continue to payment merchant to pay for your purchase">
</FORM>
Any idea why this does pre populate the Adddress details if you do a credit card purchase?It looks fine to me.
The form is calling paypay - https://www.paypal.com/cgi-bin/webscr. The image is the button that sends the form to paypal. It is going to paypal and not prepopulating the address details in paypal if you want to pay by creditt card. Any ideas why please. Thanks
add this in your code it will work and also enable auto return ul option in your account in website payment prefrence under the selling prefrence under profile under my account option
<input type="hidden" name="return" value="http://abctest.com./purchase/thank-you.php">
(edit show code...)