Skip to content

Stripe

Create function_

Add paid app subscription plans to your app with Stripe and Appwrite Functions.

2 min read

Raw

Head to the Appwrite Console and create a new project if you haven't already. If this is your first time using Appwrite, you will be asked to sign up first.

Find the template

Once inside your project, switch to the Functions page from the left sidebar and open the Templates tab. Use the search bar to look for subscriptions, and you will find the Subscriptions with Stripe template. Click the template card, then click Create from template.

Subscriptions with Stripe template
Subscriptions with Stripe template

Configure function

Under Details, you can customize the function's Function name, Function ID, and Runtime, or leave them as they are. Keep Public turned on, since Stripe and the demo app call the function without an Appwrite session.

The function's domain is generated from its name, for example subscriptions-with-stripe.fra.appwrite.run. You will need this domain in the next step.

Leave Connect later selected. Appwrite deploys the template's code directly, so you don't need a Git repository for this tutorial. If you'd like to manage the code in your own repository, you can select Connect your repository instead, or connect one later from the function's settings.

Configure variables

Under Template variables, fill the STRIPE_SECRET_KEY variable with the secret key you copied from Stripe's API keys page.

Similarly, fill the STRIPE_WEBHOOK_SECRET variable with the signing secret you copied after creating the webhook.

You don't need to create an Appwrite API key. The template sets the scopes the function needs, and Appwrite passes a short-lived API key with those scopes to every execution.

Deploy

Click Create and deploy. Appwrite creates the function and builds its first deployment. Once the build finishes, you will see the function's domain, which you can visit with Open URL.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.