JSPM

@aquarian-metals/coin-moebius-stripe

4.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q113501F
  • License MIT

Stripe provider for Coin Moebius — browser checkout entry plus a server-only webhook verifier under the ./server subpath.

Package Exports

  • @aquarian-metals/coin-moebius-stripe
  • @aquarian-metals/coin-moebius-stripe/package.json
  • @aquarian-metals/coin-moebius-stripe/server

Readme

@aquarian-metals/coin-moebius-stripe

Stripe provider for Coin Moebius.

Two entries in one package:

  • @aquarian-metals/coin-moebius-stripe — browser entry, kicks off Stripe Checkout.
  • @aquarian-metals/coin-moebius-stripe/server — Node-only webhook verifier. Never import this from browser code.

Install

For the browser:

npm install @aquarian-metals/coin-moebius-stripe

For server-side webhook verification, additionally install the official Stripe SDK (declared as an optional peer so it stays out of browser bundles):

npm install stripe

Use — browser

import createStripeProvider from '@aquarian-metals/coin-moebius-stripe';
import { createPaymentManager } from '@aquarian-metals/coin-moebius';

const payments = createPaymentManager({
  providers: [
    createStripeProvider({
      publishableKey: import.meta.env.VITE_STRIPE_KEY,
      // optional — defaults to '/api/checkout/stripe'
      sessionEndpoint: '/api/create-stripe-session',
    }),
  ],
});

Use — server

import { registerVerifier } from '@aquarian-metals/coin-moebius-server';
import { createStripeVerifier } from '@aquarian-metals/coin-moebius-stripe/server';

registerVerifier(
  'stripe',
  createStripeVerifier({
    endpointSecret: process.env.STRIPE_WEBHOOK_SECRET,
    // Optional but recommended — pass your secret key so the same Stripe
    // instance can be reused for refunds / retrieval calls in this function.
    secretKey: process.env.STRIPE_SECRET_KEY,
  }),
);

See the main README for the full quick-start.

Subscriptions

The verifier surfaces five normalized subscription event types on top of the existing one-time payment events:

  • subscription.created
  • subscription.renewed
  • subscription.payment_failed
  • subscription.canceled
  • subscription.updated

Branch on event.kind === 'subscription' and switch on event.type. See docs/subscriptions.md in the repo for the full walkthrough.

For cancellation, the package also exports a helper that returns a hosted Stripe Customer Portal URL. The buyer manages cancellation, card updates, and receipt downloads inside Stripe's UI:

import { getStripePortalUrl } from '@aquarian-metals/coin-moebius-stripe/server';

const url = await getStripePortalUrl({
  secretKey: process.env.STRIPE_SECRET_KEY,
  customerId: 'cus_buyer_abc',
  returnUrl: 'https://you.example/account',
});

You must enable the Customer Portal once in your Stripe Dashboard before this call succeeds.

License

MIT — see LICENSE.