Google Checkout subscription: How to identify the user - google-checkout

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

Related

Handle downgrade strategy with stripe

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.

Why would a Subscription have no Payment Method Token, and how can I map it to a Customer?

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.

linking parse and stripe user

My app requires users to log in with Parse to make a purchase and uses parse cloud to process payments using Stripe. Payment works fine. I want to associate the card that just used to make the payment to the [PFUser currentUser] so I can load the cards for user to select next time. How can I achieve that? Is it possible to get the card information from the token?
P.S one user can have many card and one card can belong to many user.
I'm not sure exactly what you mean by "card information" but it should be possible to achieve what you want. You'll want to first create a Customer object in Stripe to represent each user. Each Stripe Customer has a list of payment sources associated with them, and you can read the brand and last4 if you need to display a list of these to the user to select one.
Once you create a customer in Stripe, you can create any number of Charges.
All of this can be done in a straightforward manner using the intuitive Stripe API. You can also manage Customers and Charges via the Stripe dashboard.

How to check if user subscription is up to date?

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.

Send unique id to google checkout

I'd like to use google checkout to charge for subscriptions to my website. In order to efficiently process orders, I need to collect the purchaser's email address or another unique id for that order, so that later I can activate their account.
Is there a way to programmatically associate an id that I can generate at runtime with an order placed in google checkout?
If possible, I'd like to do this just by generating different html for the "buy now" button. If necessary, I can use the API.
Update: I see various mentions of merchant-item-id, and when I create a button with Google's tools I can set that field statically. If there were a dynamic way to set merchant-item-id, that would be perfect. Any solutions like that?
Look in to the notification API:
http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Notification_API.html
Changing the code of the buy now button wouldn't actually notify you if the order was completed - there'd be no way to determine if a user just loaded the buy now page, completed the payment, or if the payment was declined. With the notification api you can instantly activate the subscription only when payment is received. Of course, you have to write the script to receive the notification...
The only other option I see if changing the continue_url to somehow change the thank you page to include the id, but this is easy to fake.
The answer seems trivial now. Just throw:
<input name="shopping-cart.items.item-1.merchant-item-id" type="hidden" value="11235" />
into your BuyNow button code (or whatever form you're using to submit) with 11235 being any value you like.

Resources