UNPKG

opengig-stripe

Version:

A wrapper for Stripe payment services with support for checkout and payment intents

35 lines (34 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StripePaymentIntent = void 0; class StripePaymentIntent { constructor(stripe) { this.stripe = stripe; } async create({ amount, currency = 'usd', customerId, metadata = {}, }) { return await this.stripe.paymentIntents.create({ amount: amount * 100, currency, customer: customerId, metadata, automatic_payment_methods: { enabled: true, }, }); } async confirm(paymentIntentId, paymentMethodId) { return await this.stripe.paymentIntents.confirm(paymentIntentId, { payment_method: paymentMethodId, }); } async retrieve(paymentIntentId) { return await this.stripe.paymentIntents.retrieve(paymentIntentId); } async update(paymentIntentId, data) { return await this.stripe.paymentIntents.update(paymentIntentId, data); } async cancel(paymentIntentId) { return await this.stripe.paymentIntents.cancel(paymentIntentId); } } exports.StripePaymentIntent = StripePaymentIntent;