Skip to content

senecajs/seneca-stripe-provider

Repository files navigation

Seneca Stripe-Provider

Seneca Stripe-Provider is a plugin for Seneca

Provides access to the Stripe API using the Seneca provider convention. Stripe API entities are represented as Seneca entities so that they can be accessed using the Seneca entity API and messages.

See seneca-entity and the Seneca Data Entities Tutorial for more details on the Seneca entity API.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

Voxgig This open source module is sponsored and supported by Voxgig.

Quick Example

// Setup - get the secret key separately from a vault or environment variable.
Seneca()
  // Load API keys using the seneca-env plugin
  .use('env', {
    var: {
      $STRIPE_SECRETKEY: String,
    },
  })
  .use('provider', {
    provider: {
      stripe: {
        keys: {
          secret: { value: '$STRIPE_SECRETKEY' },
        },
      },
    },
  })
  .use('stripe-provider')

// Create a checkout session
let checkout = await seneca.entity('provider/stripe/checkout').save$({
  mode: 'payment',
  success_url: 'https://example.com/success',
  line_items: [{ price: 'price_xxx', quantity: 1 }],
})

console.log('CHECKOUT SESSION', checkout)

// Retrieve a checkout session by ID
let session = await seneca
  .entity('provider/stripe/checkout')
  .load$({ id: checkout.id })

console.log('SESSION', session)

Install

$ npm install @seneca/stripe-provider

Options

  • debug : boolean
  • init$ : boolean

Action Patterns

Action Descriptions

« sys:provider,get:info,provider:stripe »

Get information about the Stripe plugin.


Supported Entities

provider/stripe/checkout

Wraps Stripe Checkout Sessions.

Operation Method Description
Create entity.save$(params) Create a new Stripe Checkout Session
Retrieve entity.load$({ id }) Retrieve a Checkout Session by ID
List entity.list$(params) List Checkout Sessions
Expire entity.remove$({ id }) Expire (cancel) a Checkout Session

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors