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.
Related
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.
I have to manage the recurring payment for our online service, but there is an aspect not very clear to me.
From what I understand, to manage a subscription I need to:
Create the product
Create the subscription plan
Create the subscription
I have done some tests and everything works correctly.
What I don't understand is whether the product and the respective subscription plan need to be created for each transaction or if I first need to create a product list with their associated subscription plans and always use the same items when creating the subscription.
You need to create the product and subscription plan for the first time. If any person has subscribed to your product, the money will be automatically deducted at the onset of the next billing cycle. It will use the same product and plan for which the person has subscribed for.
For more detail, you can go through https://medium.com/analytics-vidhya/paypal-subscription-in-react-1121c39b26be.
Create new Products and Plans when you have new Products, or are offering new or additional Plans.
Otherwise, use existing items for new Subscriptions.
I want integrate paypal to my membership site. After i checked paypal documentation i realised that i cant find any information about how to change user subscription plan, for example some users become with "basic" plan but after asked to use "pro".
Can't find this function in api docs https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions
What is best practice to do it?
Per https://developer.paypal.com/docs/subscriptions/customize/revise-subscriptions/
You can upgrade or downgrade a subscription by changing the plan and/or quantity of the subscription. Changing from one plan to another is allowed only across plans within the same product.
For example, you can revise a subscription from a $10 basic plan to a $14 premium plan, or revise a five software licenses monthly subscription to 10 licenses per month.
Subscription revisions require the buyer's consent. If the buyer doesn't consent, they continue to be billed according to their current subscription. All successful revisions are effective in the next billing cycle.
It's documented here, although sometimes the "Revise Subscription" section is not rendered correctly.
https://developer.paypal.com/api/subscriptions/v1/#subscriptions_revise
I am looking for alternatives to stripe's per-user pricing subscription : I need :
to charge my user a recurring payment which depends on the number of user accounts he has
to be able to change the number of users via an API, with customer validation is ok, but ideally without changing a plan nor creating a new type of plan. Check status, cancel, etc. via the API too.
Ideally with no up-front charge = fee + percentage of transaction
I found out that stripe might be a good option (see per-user pricing here https://stripe.com/docs/subscriptions) and unfortunately Paypal does not seem to offer this kind of feature (plans can only be increased by 20% each 180 days or you need to cancel previous profile and create a new one). Or am I mistaking about Paypal ?
What alternatives would exist for such needs?
What you want are Reference Transactions, in which case you run an original authorization or sale transaction, and then in the future you'd run DoReferenceTransaction with the original transaction ID and any new amount you need to process. It will process immediately without any redirection or additional authorization required at that point.
If you use reference transactions with Payments Pro (direct credit cards) then all you need to do is save the original auth or sale transaction ID to your database so that you can pull it out for the user when you need to process a future payment using DoReferenceTransaction.
For PayPal payments you'll use Express Checkout w/ Billing Agreements, which will give you back a billing agreement ID. In that case, the billing agreement ID is what you'd pass into future calls to DoReferenceTransaction.
In either case you'll need to build your own system to lookup payments that need to be processed each day and loop through them making a call to DoReferenceTransaction for each one.
My question is whether I am allowed to change any attributes of a Billing Plan that already has Agreements associated with it. (I understand that I am not allowed to change the terms of the Plan i.e. payment_definitions - amount, frequency etc..)
It seems that some of the fields of a Plan should be allowed to be updated even if they have Agreements.
For example, my initial monthly plan was $10 a month and I don't want to offer that plan anymore. I would like to update the Billing Plan to make its state "INACTIVE". This will not affect users who already have an Agreement with this plan, but will allow me to go ahead and offer a $12 monthly plan to new users who sign up.
Another example might be if I want to change the name or description of the plan. This would not affect the terms that the user agreed to, so am I allowed to update it?