New to the community? Welcome! Please read our Community Rules and Guidelines
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.
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.
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.
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.
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)
Hope this helps someone (: