Published on

Implementing LemonSqueezy Payments for Crontap šŸ’°


Implementing payments for Crontap today or going bust.

Gonna use @lmsqueezy & write about my progress in this thread šŸ‘‡

Never used @lmsqueezy before, but had a verified account with them.

Let's see how easy it is to use.

Plan based on quick research:

  • create subscription & product
  • use lemon.js to integrate
  • I won't integrate with BE to get this in faster
  • on a successful purchase with lemon.js I'll make an API call from the FE to update status
  • if it goes wrong should be fairly easy to match transaction with account
  • I don't worry about cancelling
  • I will manually handle that until it gets annoying.
  • later I can set up a function that I call daily with to update accounts that cancelled.

Or is there a low effort way to do this? Don't want to spend time on it.


āœ… added subscriptions

Regarding the cancel check above. @marvr_ tells me I can use sub ID & look up through the LMSQZY API. However I still need a custom cloud function for it because I need to pause running schedules. Will for sure postpone this & do manually initially

lemonsqueezy implementation for crontap


First test purchase

No checks yet.
The LemonSqueezy DX was not too great tbh.

Missing React SDK, unclear how you configure lemon.js and how to get the url (share?!)

lemonsqueezy implementation for crontap


āœ… Hooked up to own the db

Still missing:

  • UI to show status
  • UI to manage sub (I think I'll just link to LS?)

BUT forgot I was supposed to grab beers in 30 min so I will have to pause until tmrw. Feels close, but probably better this way so I can also test it properly.


Some more feedback for @lmsqueezy

  • it should be possible to get custom fields when retrieving a subscription from the API. Is there really no way to get custom fields except for webhooks?!

  • would be nice to collapse the "Response" in the API docs. It could be interactive too - allow making requests right in the docs but that's more of a nice to have.

Update the next daye

Back at it now.
Wanted to do a simple endpoint to show if you are pro or not. Can't find a way to filter subscriptions by status :(

This will get annoying with users that have a longer history, a simple [status]=active would go a long way.

lemonsqueezy implementation for crontap


I might be holding this completely wrong. But in a SaaS context where it should be easier to get a list of active subscriptions based on SaaS user id (as a custom property).



What happened? I thought I can use a simple SDK that handled everything for me. That I didn't need to store anything in my own DB.

That ofc would have coupled me with LS both data & uptime-wise but I was fine with that if it saved me a bunch of dev time.

I had to do it the proper way instead.

Which is: use webhooks to sync LemonSqueezy order & subscription data with my own DB.

Any clever way to test webhooks locally? Asking for a friend šŸ˜ž

No? We'll I guess I'll just do it in the blind and deploy. When did that ever go sideways.


I've dug a hole in my hole. Now I am a lot further from where I was last afternoon šŸ¤£

āœ… bought a new domain for tunneling
āœ… set up cloudflare tunnel
āœ… verified X-Signature hash
āœ… created TS models for LS webhook evts
āœ… deleted prev code šŸ˜ƒ

tomorrow is another day

continue reading

view source on twitter