Stripe provider for AdonisJS 5
This packages makes it seamless to work with Stripe in AdonisJS 5 applications.
Install the package using either npm or yarn:
npm i @mezielabs/adonis-stripe
# or
yarn add @mezielabs/adonis-stripe
Then, configure the package using the configure
command:
node ace configure @mezielabs/adonis-stripe
This package needs to be configured with your Stripe account's API keys, which you can get from your Stripe Dashboard. Also, you can specify the API version as well as your webhook secret.
// .env
STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY
STRIPE_PUBLIC_KEY=YOUR_STRIPE_PUBLISHABLE_KEY
STRIPE_API_VERSION=STRIPE_API_VERSION // defaults to Stripe account's API version
STRIPE_WEBHOOK_SECRET=YOUR_STRIPE_WEBHOOK_SECRET
import Stripe from '@ioc:Mezielabs/Stripe'
async checkout ({ view }) {
paymentIntent = await Stripe.paymentIntents.create({
amount: 1900,
currency: 'usd'
})
}
This package is built top of stripe-node
. For usage, see the stripe-node API docs for Node.js.
Want to learn how to build projects like this with AdonisJS? Check out Adonis Mastery, where you get to learn AdonisJS through practical screencasts.