Skip to content

PaymentLink

Source: src/Stripe/PaymentLink.ts

A Stripe Payment Link — a shareable URL that opens a hosted Checkout page. Requires at least one lineItems price. Quantity, metadata, active, and most Checkout options update in place; changing the set of prices replaces the link. Payment links cannot be deleted; destroy deactivates them (active=false).

One-time price

const product = yield* Stripe.Product("pro-plan", { name: "Pro Plan" });
const price = yield* Stripe.Price("pro-once", {
product: product.id,
currency: "usd",
unitAmount: 2000,
});
const link = yield* Stripe.PaymentLink("buy", {
lineItems: [{ price: price.id, quantity: 1 }],
});

Promotion codes and a confirmation message

const link = yield* Stripe.PaymentLink("buy", {
lineItems: [{ price: price.id, quantity: 1 }],
allowPromotionCodes: true,
afterCompletion: {
type: "hosted_confirmation",
hostedConfirmation: { customMessage: "Thanks for your order." },
},
metadata: { campaign: "launch" },
});
const link = yield* Stripe.PaymentLink("buy", {
lineItems: [{ price: price.id, quantity: 2 }],
active: false,
inactiveMessage: "This link is no longer available.",
metadata: { campaign: "paused" },
});