DEV Community

Cover image for To pay or not to pay with Stripe: subscriptions from 'zero' to 'cycling'
Anastasiia Lysenko
Anastasiia Lysenko

Posted on • Updated on

To pay or not to pay with Stripe: subscriptions from 'zero' to 'cycling'

This article is the first one of my 'HowTo:Stripe' series. Set of articles will be helpful for those of managers or developers, who are planning to use Stripe as a payment system or those of you, who are already using it. I won't compare Stripe with analogs (let's just say, BrainTree is also a great fit for this purpose), but rather planning to provide a detailed instruction on how to implement a ready-and-working one-time checkout or subscription system with billing cycles.


As you may already know, Stripe has a great API. And I must say, that from my experience, it's totally true! In addition to that, there are a CLI for your needs, that also comes in handy, especially for testing purposes or if you have to register your 'products' dynamically. They even have a docker image with it inside. The documentation tells anyone everything one need to know.

Anyway, before you can set up your project payments via Stripe, you need to have answers on the following questions:

Is it going to be a 'one-time' payment or subscription?

Alt Text
In the first case, you just need to create a 'Product' and you set and go with One-Time-Checkout. The 'Product' is like an item to sell, but in more general way: newspaper subscription, business plan, set of plates are all 'Products' in the terms of the scope of Stripe. Meanwhile, in the last case you are going to need much more to work on. Anyway, you can find instructions on how to operate in both cases below.

Is amount of your 'items-to-be-paid-for' going to be a not very big and static value?

Alt Text

Why it is so important to know at the early stage of implementation? Because, there are a bad news for you in case you have a whole bunch of, let's just say, clothes with unique prices for each of them. In this case you need to clone payment details for every product in your store system in Stripe. More to it, it's necessary to do it twice: in the testing environment and in production. So, the flow for each new t-shirt will be the following: create it in your store ➡️ create it on stand ➡️ create it on production environment. Sure thing, you can do this via API query, but anyway it's time and code. The full picture looks different in the other case your 'Products' are 'subscriptions'. Also it's very convenient solution in case of not big and rarely changeable amount of items to sell.

What's a default currency for your merchant?

Alt Text

You can create a Product with just one for all countries currency, that will be automatically converted for most of the countries. You can find more about automated currency conversion and fees for it here.

Are you ready to have only one test stage and the same team working on test and live panel?

Alt Text

Despite of different Products and Webhooks setup, they really have only one team to manage Stripe at web panel. The list of Roles are also not so wide: only six of them and only two of them has 'read' access to Webhooks section, but along with it those users are going to have 'write' access to customers, subscriptions and so on. So, important to know: your 'Developers' are going to have broad list of possibilities on production environments. The full list is here.

If at this point you define Stripe as a fit, that fulfill your purposes, then you need to go to your Stripe Dashboard and setup your Stripe system with a branding, team and products.

On initial setup, you can leave all settings as they are, but you are definitely have to create a 'Product' and a 'Price' with default currency for each product. If it's a Subscription, then you need to choose a 'Billing cycle'. 'Billing cycle' and currency are customizable here. By default, it's 'month/half of year/year' as billing cycle and 'usd' as default currency.

The next article is ready for you on this Stripe journey.


Keep your code clean and yourself safe and sound.

Top comments (0)