@scrip-systems/checkout-widget, or build your own UI on top of the same server routes.
This guide builds on the PaymentIntents setup (scrip, stripe, Cart, fullPrice, syncIntent, and requireOpen) in Pay with points at checkout with Stripe.
Add the widget
The widget lets shoppers enter a dollar amount, click Apply, and pay the remaining balance by card. It never calls Scrip or Stripe directly: it calls callbacks you provide, and your server holds the points and updates the PaymentIntent.
Keep all authoritative cart state on your server (
totalMinor, intentId, redemptionIds, and card). Treat browser requests as shopper intent only.
Server helpers and apply route
Load the shopper’s available balance at page render, and handle point applications on your server (PROGRAM_ID and ASSET_ID are your own constants):
Serve and mount the widget
Serve the global widget bundle from your server, include the script on your checkout page, and callwindow.ScripCheckout.mount:
<script> tag:
mount also accepts onChange, onError, labels, locale, minimumCharge, timeoutMs, showEmpty, poweredBy, and theme. Pass Stripe’s minimum card charge as minimumCharge (for example, { amount_minor: 50 } for USD) so the widget blocks amounts that would leave the remaining card charge below Stripe’s minimum.
If a callback times out, throws, or returns an unrecognized response, the widget shows an unavailable message with a Retry button. Retrying is safe because repeating the same cart and amount returns the same hold. If onApply returns price_changed, the widget asks the shopper to confirm the updated point count, then calls onApply again with confirmed: true and the new figure as expectedPoints.
If the widget fails to load
No points are held and the PaymentIntent keeps the full order total, so the shopper pays by card as usual. Always render your order summary from your server’s cart record.Build your own control
The widget is optional. A custom UI uses the exact same three server pieces: balance data on page load, the apply route above, and a remove route backed byremovePoints. Your frontend handles the statuses documented in Read the result.
Display the shopper’s balance from available_value (the money value of available, such as { "amount_minor": 5730, "currency": "USD" } for $57.30). Hide the control when the shopper has no balance or available_value is absent. Validate the entered amount against the balance and cart total in the browser, and validate it again on your server.
PaymentIntents integration
Server-side holds, webhooks, cart updates, and refunds.
Use Stripe Checkout Sessions
Apply points as a one-time coupon on Stripe-hosted Checkout pages.