I create new customer with credit card using gateway.customer.create
I create new subscription for a customer using gateway.subscription.create
Now when my application starts I have to check if customers subscriptions is still valid. Is there any api endpoint that will allow me to do this?
I am looking for example for a method like this:
isUserSubscribed(customerId)
Maybe also something to get info in which plan user is subscribed (silver,gold,etc)
I work at Braintree. If you have more questions, feel free to reach out to our support team.
When you get a customer from Braintree, you get all of its credit cards and subscriptions:
customer = gateway.customer.find(customerId)
subscriptions = customer.credit_cards.flat_map(&:subscriptions)
You can then look at the customer's subscriptions to find any info you need.
Related
i'm building an app with multiple subscriptions plan for my users.
Let's say my user as a 'free' plan, and want to upgrade to a 'pro' plan.I'm using stripe customer billing portal, which work perfectly.
But when i want to downgrade, i would like the plan to change only a the subscription period end, unfortunately, it's change immediatly.
I know i can handle it from API, but i need to do it from the customer portal generated by stripe.
Any idea how to configure my stripe customer portal to handle downgrade this way ?
i would like the plan to change only a the subscription period end, unfortunately, it's change immediately.
This is not completely supported with Subscriptions and the Customer Portal. Any change you make to the Subscription's SubscriptionItems is immediate, e.g. changing from price_123 to price_678 happens the moment you update the Subscription.
However, using the proration_behavior: 'none' parameter on a CustomerPortal Configuration, you can configure it to not create prorations or invoice the Customer immediately but instead, defer the new payment amount on to the next Invoice.
When I receive the subscription canceled webhook I can't retrieve the customers information via their payment info because it is deleted. Specifically I am trying to get the customers e-mail.
Full disclosure: I work at Braintree.
You can extract the customer id from the webhook. You didn't specify your client library language, but this is how you would do it in Ruby:
webhook_notification = Braintree::WebhookNotification.parse(
bt_signature_param, bt_payload_param
)
customer_id = webhook_notification.subject.subscription.transactions.first.customer.id
Pass the customer id from your webhook into a Customer.find call. Then inspect the result object to extract the email address.
More information on parsing webhooks here.
If you have any additional questions, feel free to reach out to Braintree support.
I'm trying to retrieve the customer who created a subscription via its payment_method_token, as described by Braintree developer agf. However, one of my subscriptions has no Payment Method Token. The field comes back as null from the API, and shows up as a blank space in the dashboard:
The docs offer no suggestion that this field could ever be empty. What can cause this to occur, and how can I find out which customer this subscription is associated with?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
If a payment method is deleted and it has subscriptions connected to it, then the subscription will be canceled, the token will be disassociated from the subscription and you will see this in the control panel.
If there are transactions associated with the subscription, you can get customer information from the transaction objects. In this case, it seems like the subscription never created a transaction before it was deleted so unfortunately you won't be able to trace that back to a customer.
We're developing a system whereby the user will be sign-up and have a 3 month trial without entering card details. Once the trial period is up they get sent an e-mail asking them to come back and register card details in order to setup a recurring payment in order to continue accessing the site.
Is it possible to configure recurring payments with Braintree such that we don't provide a card for the trial period and then configure one upon notification that it has expired?
Thanks!
I work at Braintree. If you want more information than you can easily get on Stack Overflow, please reach out to our support team.
Braintree subscriptions require a credit card to be created. That way, the transition from trial period to billing doesn't require any action by the customer or merchant. Since our core service is billing credit cards, that's what subscriptions are designed to do.
In your case, it sounds like you can create a subscription in your application, and only link it to a Braintree subscription if / when credit card details are entered. You'll need to handle tracking the three month time limit yourself.
We are using Google Checkout - google handled subscriptions. In our html form we are using merchant-item-id parameter to store the subscription plan id and user id, so when Google Checkout send us back the notification for the new orders (merchant-item-id is there) we know what user for what plan to charge. So far this works perfect.
But now, when a month is passed, and Google Checkout start creating the reoccurring orders, there is no merchant-item-id parameter in the notifications they send. So we don't know what user for what plan is charged.
What should we use as user identifier, so we can handle properly the subscription on our site?
Any ideas?
Btw. I know about the "buyer-id" parameter which is send with each new order notification, but that will not work for us, because it is possible that the same google buyer is paying for several of our users accounts.
I would try putting some unique info in "shopping-cart.items.item-1.merchant-private-item-data" to something unique that I can identify the subscription by.
Nikolaj