mezielabs / adonis-stripe

This package makes it seamless to work with Stripe in AdonisJS 5 applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of contents

Adonis Stripe

Stripe provider for AdonisJS 5

typescript-image npm-image license-image

This packages makes it seamless to work with Stripe in AdonisJS 5 applications.

Installation

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

Usage

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.

Learn AdonisJS

Want to learn how to build projects like this with AdonisJS? Check out Adonis Mastery, where you get to learn AdonisJS through practical screencasts.

About

This package makes it seamless to work with Stripe in AdonisJS 5 applications.

License:MIT License


Languages

Language:HTML 80.0%Language:TypeScript 16.3%Language:Shell 2.1%Language:JavaScript 1.7%