Best way to skip a payment with Stripe Subscriptions (give a free month)? - subscription

I am looking to implement a referral program for our app that will gives users a free month off their subscription every time they have a successful referral.
I came across this question Stripe: add free days to a subscription but it is 6 years old so I am not sure if this is still the way to go since Stripe has updated their service and API multiple times since then.
Reading through the Stripe Docs it seems there may be 2 ways to implement:
Use a coupon and apply it against the customer's subscription. (Stripe Subscription Discounts)
Move the date for their billing cycle by 1 month (Stripe Subscription Billing Cycles)
I would imagine this is a common thing. Is there a best practice on how to proceed?

I ended up contacting Stripe customer support and option 1 is the way to go (coupons).
Basically you create a coupon that deducts 100% of the subscription fee and you enable it for 1 month only. This will effectively skip 1 month's payment. It can be enabled manually via the Stripe Dashboard or the API.
Follow this link for more details: Stripe Coupons

Related

Confusion regarding permissions (write access) for the calendar resource

I have a google account with my company domain. I received super user status so that I can access all the calendars in the workspace. I registered my app and followed oAuth2.0 authorization steps with these scopes -
https://www.googleapis.com/auth/calendar.events
https://www.googleapis.com/auth/admin.directory.resource.calendar
https://www.googleapis.com/auth/calendar
Now I am able to read all the events and subscribe to the web_hook. My doubt is twofold -
For the same user, when I fetch the calendar list using CalendarList.list method (Calendar A), it is different from the list I get when I hit calendar list API from the admin directory side (Calendar B).
Is it because there are 2 sets of calendars being maintained for the user side and one from the admin side (that is domain wide)? If so, how can I modify or create an event in calendar B? (it is pretty simple from the UI side, I open my calendar and add that particular room to the meeting).
If there is a meeting (event) planned and I need to release the meeting room (i.e. the calendar itself because the rooms are coming as calendar resources themselves) from the meeting, which API should I hit?
Actually I need to simulate real life scenario where I have a meeting scheduled in a meeting room but then I want to keep the meeting but not the room, so that the room is no longer occupied and others might use it. It is during implementation of this flow that I had above 2 doubts.
Please help me out here as I am completely new to programming and it has been days since I started banging my head over it.
To answer your concerns, please see below:
Yes, that is correct. The calendars mentioned(user and admin) are completely different calendars. As for modification in calendar B, as long as you have the calendarId, you can use Events: insert .
The room should appear in the event resources and you can update it via Events: update.

Number of online users and app visits in single page application

I making a SPA (single page application) and want to show the number of online users and app visits in the admin panel like this:
online users: 5 people
Today visits: 12 people.
This Year visits: 5263 people.
I don't know what the proper procedure is for implementing this.
What I'm doing as a solution is to make an endpoint at the server for computing number of online users and visits. In the client I've created a random string as UserKey and saved it into localStorage.Then I've used setInterval to send a request with UserKey payload to the endpoint every 5 minutes. This endpoint calculates the number of online users and visits based on UserKey and current date and time. Calculating Is not 100% Accurate but it's satisfactory for me.
I'm not sure if I'm in the right way. Please share me your advice.
You can simply do it with Navigator.onLine :
Source
Websockets (pusher) should be a right solution for your case. This way you don't have to poll every 5 minutes.
See https://pusher.com/docs/channels/getting_started/javascript/?ref=docs-index
It is free but just for 50 users if you want more users you can also choose to start an own Websocket server. Which is a little more complicated (without external libraries of course).

In app credit/currency using PayPal API

I am building a web app in cakePHP that involves a credit system.
So credits are bought with real money, then at a some point in the future they are spent and the portion the credits value goes to me and the rest goes to a third party.
So far no problem but...
If I use something like PayPal's Express Checkout, PayPal take a cut when the credits are initially bought and another cut when the third party is paid.
Or I can use PayPal's Adaptive Payments and do a Delayed Chained Payment but that has a maximum delay of 90 days.
So my question is do I have any other options?
There are only two options:
Use another payment service provider, but they'll all take their share for their service. But Paypal has become expensive.
Add the fees on top of what the user has to pay for the credits, you'll have to calculate them in advance.

Re-activating Paymill subscription, and updating Credit Card info

Paymill's API is awesome. It's a blaze to work with, and I should be up&running, were it not for an edge case. Context is a SAAS app, with a demo trial, and the ability to upgrade & downgrade at will.
User cancels her subscription: at this point, her account remains active until the pre-payment date. Paymill receives 2 API calls:
DELETE call for https://api.paymill.com/v2/subscriptions/
DELETE call for https://api.paymill.com/v2/payments/
Scenario: She changes her mind, and tries to upgrade again. So far, I've tried modeling this via:
Doing a POST to https://api.paymill.com/v2/subscriptions with client, offer, and payment info -similar to the original subscription- returns Payment error: Subscription already connected
Doing a PUT to https://api.paymill.com/v2/subscriptions/ with payment info (according to Paymill API: How do I update a subscription's credit card? ) returns Payment error: the Subscription was canceled
Desired output is Continuing Subscription: no credit card charges are made until the next monthly period, and further CC charges are applied via the new payment info.
In what ways can this be achieved?
Many thanks!
Let me start by saying that the POST you described should be possible to execute. This is currently a bug, and this will be fixed sometime next week.
But your use case is, unfortunately, not supported at the moment. We are working hard to make our subscriptions feature more powerful, while retaining the simplicity of usage. We cannot offer a timeline for this, but we would love to hear more about your case.
Currently, merchants are encouraged to manage the subscriptions on their own, as this is not a simple matter of changing the amounts being charged on the next subscription's due date. For instance, if a client of yours decide to downgrade, would you make a pro-rata refund of the excess? Same for upgrade: would you charge the full amount of the new subscription on the due date, or a pro-rata of the old subscription + pro-rata of the new?
That said, I'd encourage you to keep an eye on our blog for announcements of an improved subscriptions handling.
Disclosure: I work at PAYMILL.

Implement a paid subscription service on a website

I have a website and I would like to implement a paid subscription service. Its a simple service with only 2 types of plans. For now, ill just use Paypal. But im a little lost before start, mainly with the data model.
My main question for now is, what information do I need to keep for each subscription? Do I need to implement a shopping cart for this (dont think so)? Im not asking for a detailed explanation, just a few lights or resources to find a way to start. Thanks.
Depends on what technology you're using. Basic payments work a bit like this
-> You send them to paypal with a plan (you define the plan on paypal)
they know which amount to charge
you can pass custom parameters which they will pass back
Customer fills in application
<- paypal tells you that your predefined plan got purchased
in this same request, they send a lot of info about the payment including a GUID and your params
-> you ask paypal "hey, some one just told me this plan GUID got purchased, can you confirm"
<- paypal service returns 'yes'
-> you take the customer's ID from the params that you attached when you sent them to the paypal service and update them to "paid" in the database, or whatever
That's it in a nutshell...
Look at any subscription card mailer from any magazine and you can get an idea of what kind of data you will have to record. Start and end date for the subscription would be a good thing to keep, and what kind of plan the user is subscribed to. Once you have the end date, you just need to run a query to get the records of the users that have access. Something like
Select * from users where subscription_end_date is >= today
I'm sure there will be a lot of other columns that will go into your final product, but that will be up to you to decide what data you want to keep. What are the different states that a subscription can be in? Can someone be subscribed to both services at the same time?
PayPal does a decent job if you want to charge the same amount every month. However, if you anticipate your users making changes to their subscription plans (upgrades/downgrades) or needing to provide credits to their account for customer support purposes, PayPal would require that you cancel the subscription...and then have the customer re-subscribe.
[Full disclosure - I am a co-founder of Recurly.com]
Recurly handles the upgrades and downgrades, and provides automated customer emails to be sent out to your customers (on your behalf) for every event confirmation, and invoice that occurs. You also have a full account management dashboard and reporting so that you don't need to build this yourself.
Best of all, if you ever decide to leave PayPal, and move your business to a standalone payment gateway, Recurly stores all of your credit cards in a PCI compliant vault so you don't need to ask you customers to come back and re-subscribe. (PayPal will not return your customer credit card information). You simply configure your new gateway in Recurly, and payments will be processed without any interruption to your business.
Here is a blog post we wrote on the topic:
http://blog.recurly.com/2010/08/top-ten-reasons-to-use-recurly-vs-paypal-for-recurring-billing/
-Best of luck.
-Dan

Resources