I am using the PayPal API for subscription, so far on Sandbox and everything works as expected. I have read the whole documentation of PayPal api and unfortunately couldn't find what I need, that's why I'm asking here.
I am recently considering to add Discounts as well, and wish to have that in two ways:
New customer enters the discount code the first time they want to join the company. (e.g. use the Valentines Discount Code and get 10€ on your first month).
Already existing customers get a discount on one of the months. (Let's say they pay 25€ monthly, and they get a 10€ discount in the 3rd month for whatever reason, now the payments look something like this. 25€ 25€ 15€ 25€ etc...).
Is there really no way to add discounts to subscriptions in PayPal? I would be really glad for any hints / help. Thank you.
For discounts at checkout time, when creating the subscription and specifying a plan_id, you can also specify a plan object with different billing cycle values that override it, for example a lower regular amount or an additional lower amount trial period. See the Create Subscription API call; available parameters for the createSubscription JS SDK function are the same.
For discounts after a subscription is active, you will need to update the subscription. This can be done with the Update Subscription patch API call.
Related
I'm currently building a Flutter application with an unusual subscription model. The idea is that depending on how the user uses the app, they would seamlessly be charged a different amount of money each month. I plan to use PayPal, and I've looked into their REST API, this is what I found: https://developer.paypal.com/docs/api/payments.billing-agreements/v1/#definition-agreement_details
In this API endpoint, I'm assuming I can setup a Billing Agreement for each user of a specific amount_range, where once the user agrees to the payment, I'd be allowed to seamlessly charge each user a varying amount, within that range.
Am I correct in my conclusion?
Would this be the best approach?
if not, can you point me in the right direction for how to achieve what I'm trying to do?
I do not want to use the deprecated API. it's very important to be using REST API.
Thank you very much.
The Billing Agreement API you link to is deprecated.
Using the current PayPal Subscriptions, if you create a unique Plan for each subscriber, you can update that Plan > 10 days before their next billing date, and they will receive an email notification of the new amount.
You can use webhooks to keep track of active subscriptions and the last time you've been successfully paid for one.
If you need an internal ID for reconciliation, set the parameter custom_id when you first create the subscription; its value will be returned in webhook events for that subscription.
I am going to build a web site that will have few products, and a shopping cart. Every product will have an expiry or end time. Customers will buy any of the product(s) and after the product is expired, I need to gave back a discount of few bucks to all the customers(Partial Refund.)
Now the question is which PSP(Payment service provider) I could use for this purpose.?
I have came across Stripe (https://stripe.com/). Its a very good PSP. but they require me to store all the product information on their API and calculate prices on their own (which I dont want). All I need is to have the option of order and refund back after sometime.
Any help would be highly appreciated.
Thanks!
Stripe does not require you to store product information -- you can simply create one-off charges for the amount you want.
Once a charge has been created successfully, you can refund it, either fully or partially (by providing an amount parameter in the refund creation request.)
The Braintree API docs aren't entirely clear on a few things dealing with subscriptions.
We're building a system with multiple subscription tiers and want to give the user the ability to change tiers at any time. Updating the subscription is easy enough, and we've enabled prorated billing (though we're still not entirely clear on what Braintree is doing under the hood there).
The part I'm not seeing is how to update the price. If I change the plan id, the price does not change. I would expect the subscription to use the new plan's price - I can't imagine when it would ever make sense to not update the price. I see that I can pass a new price along with a new plan id, so I can update the price in the same call that I update the plan, but this means I have to store the price in my code as well as in Braintree. I know I can call the plans on Braintree to get the price information, but it should not be necessary to add the overhead of an additional API call.
Am I overlooking something? Is there really not a way to tell Braintree to use the price of the new subscription?
I am a developer at Braintree. Our plans are templates that are used to populate the subscription when it is created.
From our docs:
A plan is a template for your subscriptions: when you create a plan, it will be used to populate the following attributes when a new subscription is created:
plan name
description
trial period
billing day of month
number of billing cycles
amount
currency
billing cycle
Additionally our subscriptions do not inherit a new plan's price when updated
If you update the subscription's plan, the subscription will not inherit the new plan's price.
We implemented plans as templates so that merchants can safely update a plan without affecting subscriptions with existing customers.
We try to not make any assumptions about the state of a subscription when the plan id has changed to prevent its values from being changed unexpectedly. There is not a solution at this time to inherit select properties from a plan when changing a plan's subscription.
Since there is no language tag to this question, I'll use PHP.
If your customer changes subscription, what you have to do is update his current subscription in Braintree to the new plan AND set the new price of the plan too in that call.
Basically plans in Braintree are just templates (as said by pblesi). You can override any value you want. You can in theory create a $1/month plan called tiny in Braintree, but in your code subscribe the user to the tiny plan with a $500/month subscription price.
I think (guessing from here on) that Braintree just provides this system so people can add plans to their apps/websites without updating any code, because you can query all existing Braintree plans on your account and populate your GUI with their contents. If you implement something like this you can add plans later on and they will automatically appear on your site/app. On the other hand you can edit the price for existing plans on their site and it would only impact new subscribers as old customers will keep on paying the old price.
Now for the code, in PHP:
First I create a subscription:
Braintree_Subscription::create([
'paymentMethodToken' => $paymentMethodToken,
'planId' => $planId,
'price' => $price
]);
Price is just a number, the currency depends on your account configuration
Imagine my user changes his subscription on the website, I can update his subscription as follows:
Braintree_Subscription::update($subscriptionId,[
'planId' => $planId,
'price' => $price
]);
where $subscriptionId is the ID of the subscription you created when he/she first signed up (to be stored somewhere with the user info in your db for instance), $planId is the new plan and $price is the price of the new plan.
I've just implemented support for Braintree myself, and indeed, the user manual isn't always very clear, but once you know how it works it's actually a very easy system to use. A lot easier than PayPal recurring billing, for that matter.
We have a company that designed our website and we have pay pal standard set up to take payments. It works great except for theres times where there is a double order because the notifications from paypal go to one sales person and another sales guy handles the website orders. The notifications could be from more than just the website so the sales guy doesn't think anything of it when putting in the order and the notification however doesn't update on our website if the order is filed by that sales person and vis versa. Also we run into the issue of the shipping and billing addresses being different and matching them since the website shows who its going to as the main name and the pay pal will show the billing name. Any suggestions on what we can do to make it easier on our sales team?
I would HIGHLY recommend you implement paypal-ipn and process the orders into your system that way. That notice would let you use a program to process the order data into your system and avoid issues like multiple entries, keying errors, etc.
I am writing a subscription where I need to provide users a month trial and charge $5.00 after trial is finished. I just found an amazing code to do that for me.
I also have setup paypalpro plus recurring payments
This is the link
https://github.com/krio/paypal-recurring-subscriptions
Questions:
1- How to make first month Free Trial?
2- I need to update users billing and update their payment in my database so it can calculate their subscription, how would i get to call from paypal to my files to update?
If you are using subscriptions and you are wanting to make the first month a free trial, you would need to pass over the following variables and values.
a1=0
p1=1
t1=M
You can find a description of all of the variables for subscriptions here.
If you are wanting to get updates back to your system/database to update your profiles and etc, you can use IPN to do this. Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.