Cancelling Google Wallet subscription - android-pay

This is a basic functionality of subscription so I must be missing something!
How can I programmaticaly cancel a Google Wallet subscription? Obviously when the user cancels their account with our service we need to cancel their subscription, instead of having to ask them to go to their Google Wallet console and cancel it themselves or us having to do it manually for every cancellation from our console?
[EDIT] Just to clarify, the question is about Google Wallet subscriptions (digital goods)
See above note, as I understand the only way for a cancellation of payment is a manual one, so when a user cancels our service they either have to go and cancel the payment themselves, or for us to do it manually.

Users can view the status of all of their subscriptions and cancel them if necessary from the My Apps screen in the Play Store app. Currently, the In-app Billing API does not provide support for programatically canceling subscriptions from inside the purchasing app.
More details can be found at Subscription Cancellation

Related

How to disable "renew" option for canceled plans on Billing Portal?

I am using Stripe and Billing Portal.
If the user has canceled subscriptions in the past, then Billing Portal displays a list of canceled subscriptions and offers the option to renew for each canceled subscription:
The problem is that this allows users to subscribe to the same or different membership multiple times. For example, if I want my website to offer three types of membership:
Pro
Premium
Gold
and users can only be subscribed to one type of membership at a time - Billing Portal with that "renew" option allows user to subscribe to the two or more memberships (subscription plans) at a time: Lets say that user first subscribes to "Premium", then he cancels it... Then subscribes again to "Premium"... On Billing Portal he will be able to "renew" (subscribe) to "Premium" again...
Is it possible to disable (remove) that "renew" button (option)? I was looking into settings but couldn't find anything: https://dashboard.stripe.com/test/settings/billing/portal
Also I couldn't find anything in the documentation, FAQ section, etc.
That's because those subscriptions are set to cancel at period end, rather than immediately. They are not actually cancelled yet and can be reactivated. How are you cancelling these subscriptions?
If cancelling yourself via the API, make sure you aren't using cancel_at_period_end (API ref) and instead cancel immediately.
If you're letting customers cancel via portal, make sure to set the cancellation mode=immediately (API ref).
Similar options should be available if cancelled via the dashboard.
Once in this state (say if it were what you wanted), you can limit the portal session to only apply to a specific product/price. So you'd need to determine which of your gold/pro products was the active/new plan and create a portal configuration that only allowed updates for subscriptions for that product/price.

How to handle "incomplete" trial subscriptions

We are currently using Stripe to offer a subscription service with 30 days free trial. Since we don't want the customer to be able to start the free trial without authorizing one payment method we use the SetupIntent of the created Subscription to present a card input to our client. Now the issue is that even before the customer is shown the card input the subscription is already created and "paid" for because it is a free trial.
This means that we cannot listen to the initial invoice.paid Webhook to activate the account, but instead need to listen to setup_intent.succeeded. This seems a bit odd and requires us to link the SetupIntent to a Subscription. It also means that when a customer cancels the subscription process before entering their card details, that Stripe still has created an active Subscription in trial.
Is there something we can do differently, or should we just accept that the subscriptions where the SetupIntent was aborted will be inactive on the Stripe side once it tries to pay for the next (non-trial) invoices?
Stripe's docs use the Setup Intent that's created with a trialing Subscription to collect a customer's Payment Method, but for your use case it may make more sense to create your own Setup Intent up front and not create the Subscription unless the Setup Intent it successful. It'd go something like this:
Create the Setup Intent
Confirm the Setup Intent after collecting details
If successful, create the trialing Subscription
Alternatively, you could try using Checkout which does require users to submit a Payment Method even from trialing Subscriptions

Google IAP In App Purchase auto-renewing subscriptions Webhook for Subscription update / cancellation in NodeJS

Is there any way to implement a Webhook for automatic update of subscriptions on server side, in nodejs for example, for situations such as: the user renewed or canceled his subscription?
Currently I save the subscription data in my Database after purchase and use the Google Developers API to verify that it has been renewed or canceled when necessary.
However, for some Administrator routines I need to check all subscriptions at once and this includes calling the Google API for each one. This process is slow and can take a long time.
I could create a method that checks and updates all subscriptions according to the Google API response, and leave this process running through a Cronjob every day at night. I believe it will work, but a server-side Webhook would be the ideal solution.
Something which automatically notifies my server as soon as there is a change to a subscription so that I can update it in my DB immediately.
Found the answer. We can use Google Cloud Platform (GCP) to subscribe to topics and receive real-time notifications when a subscription change.
All steps are described in detail in their documentation: https://developer.android.com/google/play/billing/getting-ready#configure-rtdn

Handle cancellation of in app subscriptions in chrome extension

I have developed a chrome extension, I am trying to integrate in-app subscriptions using google.payments.inapp APIs, however while testing I found that if user cancels in-app subscription, the status from API shows ACTIVE instead of CANCELLED. Below is code that I am using to fetch purchased in-app subscriptions by user
google.payments.inapp.getPurchases({
'parameters': {env: "prod"},
'success': ami_onLicenseUpdate,
'failure': ami_onLicenseUpdateFailed
});
I am always receiving below response on success, even if user has cancelled subscription
{"response":{"details":[{"kind":"chromewebstore#payment","itemId":"xxxxxxxxx","sku":"xxxxxx_01","createdTime":"1509281736005","state":"ACTIVE"},{"kind":"chromewebstore#payment","itemId":"xxxxxxx","sku":"xxxxxxx_02","createdTime":"1508736958450","state":"ACTIVE"}]}}
How do I know if user has cancelled subscription?
After doing some research and testing, I found that if user is in subscription's trial period and user cancels subscription, google payment api will return subscription as active and once that trial period is over, it will not return any license related information for that subscription in api response. This way we can identify if user has active subscription or no.
One more note, for those who work with subscriptions.
Received from Chrome Web Store team:
After the cancellation, a user still will be able to access to your item until the next billing cycle starts and the extension should stop working after the subscription period is over (Monthly or Yearly). Therefore, the API is still responding back as "Active" right after the cancellation was initiated.

How do I manage subscription using Stripe.js

How do I manage subscription using Stripe.js.
Basically, I need to create a subscription, change a subscription, delete a subscription and check if a subscription is active.
The demos and examples on the Stripe site only use PHP, Node.js, Ruby etc. They do not show how to do it using javascript and Strip.js.
Stripe.js can only be used to create a card or a bank account token in the browser. Once this is done you need to send it to your server where you would create a charge or a subscription.
The same would go to update or cancel and existing subscription and this can only happen on the server. You would offer a button in your UI for example so that your customer can cancel his subscription but you would just post to your server where you effectively cancel it.
You could also look at the list of third-party services that integrate Stripe and offer recurring payments such as Charge Rabbit or Recurly.

Resources