How to apply discount code or coupon on recurring amount of subscription plan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using paypal php rest api.
I want to apply discount code or coupon or overide the recurring amount of plan for diffrent customers or on few of them.
for more clear wanted to add coupon or discount in subscription plan at the time of billing agreement, how would i achieve it as i am not able to find the way please suggest me.
Thank you
- Labels:
-
Coupons & Gift Certificates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well no.
I'm comparing not using someone else's solution to building a checkout process on Stripe and PayPal. So we're not using PayPal Pro, we are using the REST API. We've built our own lovely (and I mean it is really nice) checkout page, we set up our billing plan, fire it off through the API to PayPal and get the response back. It is exactly what you want when you want to use PayPal solely as PayPal is a payment method as opposed to the rest of the services which are not of interest to us or OUR customers. They basically lower conversion rate on the way to making a sale.
In that process we want to use coupons like maybe 98% of ecommerce companies do. On Stripe this ability is native. On PayPal my dev will need to spend a day coding a coupon system. Yay!
No big deal because we can do it. But still a hurdle that really doesn't need to be here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well it would be nice if it was that simple. It's not. You have to have a plan that you send to PayPal. You can't change the terms of that plan. So....
You get the fun to build a plan for each coupon code you use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Angell Eye,
You are correct when it comes to using Coupon Codes for a Single Payment. However, adding Coupons to a Billing Agreement is not an easy task:
In extension to Bobsenoff's comment:
We attempted the following in PHP using the REST API to use Coupon Codes with a Billing Agreement:
1. Update charge_model: https://developer.paypal.com/docs/api/payments.billing-plans/v1/#definition-charge_models
This did not work as it only accepts TAX or SHIPPING as a type. Discounts do not work.
2. Update payment_definition: https://developer.paypal.com/docs/api/payments.billing-plans/v1/#definition-payment_definition
This makes the most sense, but does still not work as currently the payment_definition can only have 1 Trial definition and 1 regular payment definition.
https://developer.paypal.com/docs/subscriptions/#billing-plans
If we were able to add additional regular payment_definitions, the solution should work. This would allow us to create things like:
50% off for 2 months, then charge 100% after 2 months
As Bobsenoff mentioned, the only way to currently achieve this is by creating new Plans for every Coupon. Here are the issues we came across when attempting this:
1. On checkout, the server generates a new Billing Agreement from the provided Billing Plan. This then outputs a PayPal button on the page. IF a customer were to enter a Coupon Code, the following has to happen:
- Send AJAX request to see if a Billing Plan with the Coupon Code price exists. IF it does, generate a new Billing Agreement and update the button on the page. IF the Billing Plan doesn't exist, create it, then update the Billing Agreement button on the page. This may seem doable, but PayPal's API requests are the slowest I've seen resulting in the customer waiting for this all to happen. Not a great user experience.
2. Even though the solution above may work for Coupon Codes that should be applied forever, it does not work for Coupons that should be 50% for 2 months only (or other intervals). This would require an automatic update to a new Billing Agreement after a customers 50% period ends. I believe a new agreement would require their consent (logging in and going through the checkout process a second time), again leading to a poor user experience for customers.
These are only a couple main issues we came across when trying to develop this out. Hopefully it helps clarify the issues developers are having when it comes to applying Coupon Codes to Billing Agreements using the REST API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use to calculate the discount value in my system before the subscription amount pass to the paypal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I saw a lot of people asking for Coupon code for recurring payments and couldn't find any js code for it, so I modified the one here - https://www.paypal.com/uk/smarthelp/article/how-do-i-create-a-discount-code-or-coupon-code-for-my-pa...
For subscription payments with drop down select boxes. (option select)
<script type="text/javascript"> <!-- var discnt = 0; // no default percent discount var coupons = new Array ("supporter","abc"); var coupdc = new Array (10,0); var coupval = "(blanket)"; // what user entered as coupon code function ChkCoup () { // check user coupon entry var i; discnt = 0; // assume the worst for (i=0; i<coupons.length; i++) { if (coupval == coupons[i]) { discnt = coupdc[i]; // remember the discount amt alert ("Valid coupon! \n\n" + discnt + "% discount now in effect."); return true; } } alert ("'" + coupval + "' is not a valid code!"); return; } function Dollar (val) { // force to valid dollar amount var str,pos,rnd=0; if (val < .995) rnd = 1; // for old Netscape browsers str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape pos = str.indexOf ("."); if (pos > 0) str = str.substring (rnd, pos + 3); return str; } function ReadForm (obj1) { // apply the discount coupval = obj1.coupcode.value; if (!coupval){ return; //No coupon code } else { if (!ChkCoup()){ return false; } } var amt,des; /* amt = obj1.baseamt.value*1.0; // base amount des = obj1.basedes.value; // base description */ amt = obj1['option_amount'+obj1.os0.selectedIndex].value*1.0; des = obj1['option_select'+obj1.os0.selectedIndex].value; if (discnt > 0) { // only if discount is active amt = Dollar (amt - (amt * discnt/100.0)); des = des + ", " + discnt + "% dis, COUP = " + coupval; } //alert(amt); //new discount price obj1['option_amount'+obj1.os0.selectedIndex].value = amt; //Leaves out trailing zeros even if convert to string. obj1.on0.value = des; } //--> </script>
Hope this helps someone (:

- « Previous page
-
- 1
- 2
- Next page »
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How can I require a phone number in an existing recurring payment application form? in Payments Archives
- Will my subscriptions cancel or continue? in Payments Archives
- Block a seller, ASKNET, from recurring subscription charges. in Payments Archives
- Close account in Payments Archives
- Merchant charged me after saying my subscription would not be renewed in Disputes and Limitations Archives