Calculating discount in paypal add to cart form - php

I'm new at using paypal add to cart form.i want to calculate discount for entire cart amount.
I even try discount_rate_cart and discount_amount_cart by referring this link.
Link
But, it doesn't working.
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="example#gmail.com">
<input type="hidden" name="business" value="sample#gmail.com">
<input type="hidden" name="item_name" id="item_name" value="test">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" id="amount" value="24.99">
<input type="hidden" name="discount_amount_cart" value="20.00">
<input type="hidden" name="currency_code" value="USD">
Thanks in advance.
Regards,
shahana

Thanks you all.I got a solution to my question.
If you are using discount in amount in add to cart form :
<input type="hidden" value=".50" name="discount_amount">
<input type="hidden" value=".50" name="discount_amount2">
If you are using discount in rate in add to cart form:
<input type="hidden" value="50" name="discount_rate">
<input type="hidden" value="50" name="discount_rate2">

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>

Unable to pass amount in paypal using _xclick

I am trying to create simple PayPal button who pass amount and quantity details to PayPal. I am unable to pass hardcore amount in PayPal. I am expecting to show result like this:
Expected output
Problem is that my amount is not transferring to PayPal. Please support to resolve. Here is my code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" amount="1.0">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="hmmdmlk#gmail.com">
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="submit" value="PayPal">
</form>
When using _xclick, which is for operations on a single item, you want:
<input type="hidden" name="item_name" value="The item name.">
<input type="hidden" name="amount" value="1.00">
The multi-item parameters you were using would be for _cart with upload=1, not _xclick
Documentation: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/

how to use paypal subscription form for multiple subscriptions?

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?

How can i send multiple items through buy now button of Paypal

I desperately need some help, I cannot find the answer anywhere.
What I need to build is a "buy now" form (or button) where it send multiple items. I am selling tickets for an event, which has different prices for Adult and Child tickets. I have already used the "Add to cart" buttons individually, but my older customers are stuggling with this, especially mobile users. Also, this is really not the most professional way of doing it in my case.
Just as an example, here is a form which is similar to what I need: http://lowfestival.es/abonos/ (I know this is not a paypal form, nor the same, but im sure you understand.
I just need 2 items (Adult and Child) with 2 quantity boxes and the Pay Now button.
If this is not possible for some reason, can anyone recommend a free 3rd party cart which could do the job?
Many many many thanks in advance for any help.
Kindest Regards
The Cart Upload command will do this for you: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/cart_upload/
For example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="youremailaddress#yourdomain.com">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="item_name_1" value="First item name">
<!-- Change this to the price of the first item -->
<input type="hidden" name="amount_1" value="15.00">
Quantity of first item:
<input type="number" name="quantity_1" size="2" min="1" max="99" required="required"><br>
<input type="hidden" name="item_name_2" value="Second item name">
<!-- Change this to the price of the second item -->
<input type="hidden" name="amount_2" value="20.00">
Quantity of second item:
<input type="number" name="quantity_2" size="2" min="1" max="99" required="required"><br>
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_buynow_cc_171x47.png">
</form>
<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="42">
<input type="hidden" name="item_name_2" value="towel">
<input type="hidden" name="amount_2" value="13">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" name="submit">
</form>

Paypal Integration with PHP

I am using this code to create my subscription for PayPal.
But it is not recognizing any of my input fields. Would you be able to shed some light on why not?
<form method="POST" name="gateway_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="EMAIL"/>
<input type="hidden" name="currency_code" value="CAD"/>
<input type="hidden" name="return" value="http://www.URL.com/payment/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://www.URL.com/payment/paypal_failure.php"/>
<input type="hidden" name="notify_url" value="http://www.URL.com/payment/paypal_ipn.php"/>
<input type="hidden" name="item_name" value="Monthly Subscription"/>
<input type="hidden" name="discount_amount" value="0.00"/>
<input type="hidden" name="a3" value="49.00"/>
<input type="hidden" name="t3" value="M"/>
<input type="hidden" name="p3" value="30"/>
<input type="hidden" name="src" value="1"/>
<input type="hidden" name="sra" value="1"/>
<input type="hidden" name="srt" value="1"/>
<input type="submit" value="Click Here"></p>
</form>
You need to tell PayPal who is submitting the request by submitting the required URL parameters user, pwd, version, and (recommended but optional) signature, along with the other parameters you're sending in the POST request. See API Overview.
Take a look at this link:
Subscriptions and Recurring Payments Variables
https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside
Also, I suggest you use a hosted button. It makes the whole process very easy.
Well both you guys were right, but the issue that came about was because on my 3rd line there
<input type="hidden" name="cmd" value="_xclick"/>
needs to become
<input type="hidden" name="cmd" value="_xclick-subscriptions"/>
Thanks for your help!

Categories