Is it possible to build Stripe subscriptions using custom code within Zapier workflows?

I’m working with Zapier and Stripe to handle user subscriptions for our software licenses. We also use Keygen.sh for license key generation.

My current setup works fine for single license purchases, but I run into problems when customers want to buy multiple licenses at once. Right now I’m using a loop to create separate subscriptions for each license, which creates multiple invoices. This is not what I want.

The built-in Zapier action for creating Stripe subscriptions doesn’t have a quantity option, so I thought about using the Code action to call the Stripe API directly. But it seems like the Code action only supports basic JavaScript and Python modules, not external libraries like Stripe.

I need to find a way to create subscriptions with quantity settings to avoid multiple invoices. Has anyone found a workaround for this? What would be the best approach to handle bulk license purchases through Zapier and Stripe integration?

Any suggestions would be really helpful since I’m stuck on this issue.

Yes, you can use custom code in Zapier to create Stripe subscriptions with quantities. Just use the built-in fetch() function instead of the Stripe library. I’ve done this when the standard Zapier actions weren’t flexible enough.

In your Code by Zapier step, make direct HTTP requests to Stripe’s API. Hit the /v1/subscriptions endpoint and include the quantity parameter in your request body. You’ll need your Stripe secret key in the Authorization header as a Bearer token.

The tricky part is getting the authentication and request formatting right, but it’s totally doable with vanilla JavaScript. I’d recommend testing your API calls in Postman first to nail down the exact parameters before moving to Zapier.

This fixed my multiple invoice problem - instead of looping single subscriptions, everything gets consolidated into one invoice like it should. Custom code gives you way more flexibility than the built-in actions.

I had the same problem. Use Code by Zapier to make direct API calls - it’s the best approach. Skip the SDK and use the built-in fetch() function to hit Stripe’s REST API directly. When you create the subscription, make sure you include the quantity parameter in your request body. This bundles multiple licenses under one subscription line item instead of creating separate subscriptions for each. Structure your request to the /v1/subscriptions endpoint with customer ID, price ID, and quantity. Parse the JSON response properly and grab the subscription ID for whatever comes next in your workflow. Also double-check that your Stripe pricing setup actually supports quantities.

you could also use zapier’s webhooks instead of the code action. just create a simple endpoint that handles the stripe api call with the right quantity parameters. I’ve found this way more reliable than debugging api calls inside zapier’s code environment. plus you get better error handling and can reuse the endpoint for other workflows.