How I link LINE users to Stripe subscriptions with Make
LINE is the messaging app most people in Japan use every day. If you sell a subscription inside LINE, you need to know which LINE user paid. Stripe does not know who that is unless you tell it.
I solved this with one URL parameter and a small Make scenario. This post covers how the link works, what it costs, the trial bug that broke it, and what I would change.
What it does
The setup connects LINE users to Stripe subscriptions for a subscription-based AI chat service I run on LINE in Japan. Users pay a few thousand yen a month, and new users start with a free trial.
It is a small service: two paying users today. Both have stayed since launch, about four months, and nobody has cancelled yet. From what they tell me, they are happy with it.
Make does three jobs here:
- It links each LINE user to a Stripe customer.
- It keeps each user’s status in a Data store in sync with Stripe.
- It opens a personal billing page from the LINE menu in one tap.
The stack and the flow
The stack is LINE, Stripe and Make. All user records live in a Make Data store, one record per LINE user.
- Stripe Payment Linkcarries the LINE user ID as
client_reference_id - Stripe Checkoutthe user pays or starts a free trial
- Stripe webhookthe event sends the same ID back
- Make – webhook scenarioa Router picks the branch by event type
- Data storesaves the Stripe customer ID and the status
Linking a LINE user to a Stripe customer
The link is one parameter on the Stripe Payment Link. Each user gets a Payment Link with their LINE user ID attached as client_reference_id:
https://buy.stripe.com/test_XXXX?client_reference_id=user_123
After checkout, Stripe sends that ID back inside the event. Make reads it and writes the Stripe customer ID into that user’s Data store record. From then on, Make knows which LINE user each Stripe customer is.
Keeping status in sync
A separate scenario receives Stripe webhooks and updates the user’s status. It is a webhook trigger, a Router, and Data store modules.
At first, the Router had three branches:
checkout.session.completedset the status totrial.invoice.payment_succeededset the status topaid.customer.subscription.deletedset the status tocanceled.
The main chat scenario reads that status on every message. It decides which branch the user gets: free, trial or paid.
Opening “My page” in one tap
The “My page” button in the LINE menu opens Stripe’s Customer Portal. There, users can check their plan, change their card or cancel. They do not need to log in with an email address.
When a user taps the button, an HTTP – Make a request module calls Stripe’s POST /v1/billing_portal/sessions with that user’s Stripe customer ID. Stripe returns a one-time portal URL, and Make sends it back as a LINE reply. The button only works for users who already have a Stripe customer ID.
What it costs
The webhook scenario costs almost nothing in Make credits. On November 7, it had used about 6 credits in the current billing period. Stripe events only arrive when someone subscribes, renews or cancels.
The whole Make account runs on the Core plan, with 10,000 credits a month. My invoice is $10.59 (about ¥1,700) a month, and all my scenarios together use around 150 credits a day. Stripe has no monthly fee for this setup, only fees per payment.
What broke and how I fixed it
Users on a free trial did not get their subscription data saved. They had finished checkout, but the Data store treated them as free users.
The symptom
Some users signed up and still could not use paid features. In the Data store, their plan, status and Stripe customer ID were empty. “My page” checks for a Stripe customer ID, so it refused to open for them.
There was a side effect too. The request counter was also empty, so the number check failed the first time those users used an extra request.
The cause
My webhook depended on invoice events. During a free trial, Stripe does not charge anything, so no invoice event arrives. The trial users simply never reached the branch that saved their data.
The fix
First, I filled in the missing values for those users by hand: plan, status, Stripe customer ID, and 0 for the request counter.
Then I changed the trigger events. The scenario now listens to customer.subscription.created and customer.subscription.updated. These events arrive when a trial starts, so trial users are saved right away.
Before
checkout.session.completed→ trialinvoice.payment_succeeded→ paidcustomer.subscription.deleted→ canceled- Trial users: no invoice event, so never saved
After
customer.subscription.createdcustomer.subscription.updated- Trial users: saved as soon as the trial starts
What I’d do differently
I would choose webhook events by asking which ones fire in every case. Invoice events only cover people who have paid. Subscription events cover trials, upgrades and cancellations too.
Here is what I would do from day one:
- Start from the subscription events.
customer.subscription.created,updatedanddeletedcover the full life of a subscription, trials included. - Test with a trial user. Run one checkout with the free trial before launch. It shows this gap before real users hit it.
- Give every new record default values. An empty counter broke a number check. Setting it to 0 when the record is created avoids that.
- Keep the link in one place. The
client_reference_idon the Payment Link is the only thing that ties a LINE user to a payment. If it is missing, nothing else can fix the link later.
If you want to build something like this yourself, you can sign up for Make with my link. It gives you the Core plan free for the first month, and I earn a commission if you stay on a paid plan.