Skip to content

About

Stripe payments for AntelopeJS. Create payment intents tied to your own records and react when Stripe reports that they succeed or fail.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

2 watching

Forks

Latest commit

 

History

42 Commits

Folders and files

@antelopejs/interface-stripe

npm License Discord Docs

Stripe payments for AntelopeJS: create payment intents tied to your own records, and react when Stripe reports that they succeed or fail.

What it offers

  • GetClient() resolves to the project's configured Stripe SDK client.
  • InitializePayment creates a payment intent and stores your own identifier, such as an order ID, in its metadata.
  • WaitForPayment resolves when a payment intent succeeds and rejects when it is canceled.
  • WatchPayment and WatchAllPayments call you on every status change, with a flag that tells whether this instance received the event.

Implementations

Module Notes
@antelopejs/stripe Configures the client and receives Stripe webhooks

Install

Add the interface to the module that takes payments:

pnpm add @antelopejs/interface-stripe

Then add the implementation to the project:

ajs project modules add @antelopejs/stripe

Quick start

import {
  InitializePayment,
  WatchAllPayments,
} from "@antelopejs/interface-stripe";

export async function startCheckout(orderId: string, amountInCents: number) {
  const intent = await InitializePayment(orderId, {
    amount: amountInCents,
    currency: "eur",
    payment_method_types: ["card"],
  });
  return intent.client_secret;
}

WatchAllPayments((orderId, intent, context) => {
  if (orderId && context.local && intent.status === "succeeded") {
    markOrderPaid(orderId);
  }
});

orderId is the identifier passed to InitializePayment. Return the client secret to the authenticated payer before waiting for completion, so Stripe.js can confirm the payment. markOrderPaid stands for your own idempotent order update; handle webhook redelivery even when context.local is true. Configure the implementation's Stripe credentials and webhook endpoint before using these functions.

Documentation

Compatibility

Peer requirement:

Package Supported Tested with
@antelopejs/interface-core >=0.2.4 <1.0.0 0.2.4

Runtime dependency:

These are the runtime ranges in package.json. This package does not declare an @antelopejs/core peer range; check the implementing module's requirements too.

Contributing

Read CONTRIBUTING.md before you open a pull request. The local checks are:

pnpm install
pnpm lint
pnpm build

License

Apache-2.0

About

Stripe payments for AntelopeJS. Create payment intents tied to your own records and react when Stripe reports that they succeed or fail.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages