hps-plugin-payment-stripe
By Hyperse
hps-plugin-payment-stripe is a Payment Stripe plugin in the Hub Pay group.hps-plugin-payment-stripe provides Payment Stripe plugin capabilities for Hub Pay. Payments, billing, invoicing, and money-related capabilities. It is especially useful for payment workflows.
CoreVendure Plugins
Specifications
Technical details and package information for this product.
Package
@hyperse-hub/hps-plugin-payment-stripe
Support languages
TypeScript, JavaScript, Prolog, Shell, CSS
Last published
July 13, 2026
@hyperse-hub/hps-plugin-payment-stripe
Stripe payment integration for Vendure: one-off PaymentIntent flows, Stripe webhooks with raw-body verification, and optional subscription billing (separate handler, Admin and Shop GraphQL, dedicated webhook route).
1. Overview
- Two payment handlers — Standard card payments (
stripe) and Stripe subscriptions (stripe-subscription handler) for recurring catalog items.
- Webhooks — HTTP routes under
payment/stripe use raw body middleware so Stripe signature verification is correct. Subscription events use a separate path.
- Storefront — Creates a PaymentIntent via GraphQL and returns
clientSecret + transactionId for the Stripe.js client; settlement is aligned with webhook processing and Vendure’s payment APIs.
- Payment core — Imports
HpsPluginPaymentCore for shared helpers (PaymentHelperService, refreshPaymentStatus, quote fields).
2. Requirements
- Vendure
>= 3.0.0
- Node.js
>= 20
body-parser (peer) — Used with the raw-body middleware for Stripe webhooks.
@hyperse-hub/hps-plugin-payment-core (installed transitively with this package)
3. Install
yarn add @hyperse-hub/hps-plugin-payment-stripe
4. Vendure registration
4.1 Required: vendureHost
Set vendureHost to the public origin of your API (no trailing path), for example https://shop.example.com. It is used when building webhook URLs (including subscription webhooks documented in code).
4.2 Subscriptions
commerceRecurringStrategy — Controls how recurring prices are interpreted (defaults to DefaultCommerceRecurringStrategy from payment-core).
- The plugin registers
SubscriptionOrderItemCalculation as the order item price calculation strategy so subscription line items behave correctly.
4.3 Optional: Stripe customer linking
If stripe.storeCustomersInStripe is true, the plugin stores Stripe customer IDs on the Vendure Customer entity (custom fields). Requires a DB migration/sync.
4.4 Optional: PaymentIntent and customer hooks
stripe.metadata — Async function to attach metadata to PaymentIntent creation; merged with metadata from paymentIntentCreateParams if both exist.
stripe.paymentIntentCreateParams — Extra Stripe PaymentIntentCreateParams (amount/currency/customer are already set by the plugin).
stripe.customerCreateParams — Extra CustomerCreateParams when creating Stripe customers (email/name are already set).
5. Key concepts
5.1 Payment method configuration (Admin)
Create one or more PaymentMethod rows with the Stripe handler. Configure:
- API key — Secret key from the Stripe Dashboard.
- Publishable key (optional) — For Stripe.js; exposed on the quote for the storefront.
- Webhook secret — Signing secret for the webhook endpoint you configure in Stripe.
Point Stripe webhooks to:
- PaymentIntents / payment events —
POST {vendureHost}/payment/stripe/webhook
- Subscriptions —
POST {vendureHost}/payment/stripe-subscriptions/webhook
Register the events your deployment uses (the plugin filters to supported event types in code).
5.2 Raw body and middleware
The plugin registers middleware before listen on the Stripe webhook routes so the request body remains raw for signature verification. Do not remove or double-parse that body in your app for the same routes.
5.3 Handler behavior (high level)
- Standard Stripe handler —
createPayment in admin context reconciles payment after the webhook has established the intent; storefront flows use createStripePaymentIntent + client SDK + webhook + addPaymentToOrder as implemented in the service layer.
- Subscription handler — Separate code path for recurring products; uses Admin and Shop GraphQL extensions under this package.
5.4 Shop GraphQL (non-exhaustive)
createStripePaymentIntent — Returns { clientSecret, transactionId } for the active session order.
PaymentMethodQuote fields — e.g. publishable key resolvers for Stripe (and subscription-related fields from the extended schema).
5.5 Polling
Use refreshPaymentStatus from payment-core with orderId and transactionId when the client needs to sync settlement after redirect or SDK completion.
6. Mental model: one-off payment
- Authenticated customer has an active order.
createStripePaymentIntent creates the PaymentIntent and returns secrets/ids for Stripe.js.
- Customer completes payment in the Stripe UI.
- Stripe calls
/payment/stripe/webhook; the server validates the signature and updates order/payment state through Vendure.
- Storefront calls
addPaymentToOrder as required by your integration; use refreshPaymentStatus if you need a poll-based fallback.
@hyperse-hub/hps-plugin-payment-core — refreshPaymentStatus, PaymentMethodQuote.clientConfig, DefaultCommerceRecurringStrategy, subscription strategy types.
8. License
MIT
import { HpsPluginPaymentStripe } from '@hyperse-hub/hps-plugin-payment-stripe';
import { DefaultCommerceRecurringStrategy } from '@hyperse-hub/hps-plugin-payment-core';