Payment methods wallets then card — Storefront block
Prostorefront-payment-methods-wallets-then-card · for checkout pages
Payment methods wallets then card
The shop takes wallets: express buttons first, a divider, then a card panel that can fold
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/storefront-payment-methods-wallets-then-cardUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontPaymentMethodsWalletsThenCard from '@/components/trame/blocks/storefront/storefront-payment-methods-wallets-then-card.vue'
const props = {
title: "Payment",
intro: "Choose how to pay for your order.",
total: 25930,
methods: [
{
id: "apple-pay",
label: "Apple Pay",
kind: "wallet"
},
{
id: "paypal-express",
label: "PayPal",
kind: "wallet"
}
],
action: {
label: "Pay",
action: "place-order"
},
walletAction: "wallet-pay",
reassurance: "Your card is charged when your order ships. Refunds within 5 business days if you return it.",
options: {
saveCard: true,
simulated: true
}
}
</script>
<template>
<StorefrontPaymentMethodsWalletsThenCard v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe step’s heading ("Payment") |
| intro | string | Wordsone line above the choice |
| total* | number | Datathe cart total in cents, from the server |
| methods* | Method[] | Datathe methods the merchant has configured: none offered, none shown |
| action | Action | the call to action: its words and the page action it runs |
| walletAction | string | Actionstarts a wallet payment (`{ id }`): the host opens the wallet’s own sheet; no action, no wallet button |
| reassurance | string | Wordsthe merchant’s real payment policy, one sentence, near the button ("Charged at shipping.") |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Method methods[] · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | the method’s id |
| label* | string | the method’s name, as shown |
| kind* | 'wallet' | 'card' | 'paypal' | 'transfer' | 'other' | what kind of method it is: wallet, card, paypal, transfer, other |
| note | string | one sentence on how it works; for a transfer, the instructions |
Action action · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe pay button’s verb ("Pay") |
| action* | string | Actionpays: `{ method, saveCard? }`; without act the form posts them to its address |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| saveCard | boolean | offer "save this card" (unchecked by default) |
| simulated | boolean | payments are a demo: say it plainly |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
checkout.pay,checkout.wallet - Reads
payment_methodsfrom your app
A storefront section, for checkout pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
More storefront blocks
- Party details per person: a card per guest, the one who books first with every field, the others with theirs, each added or removed in place beside the booking’s summary: a small party whose guests each need a few details.
- Past lookbooks covers grid: past lookbooks as a grid of covers with their season and status: the archive of a brand that has history.
- Payment explainer numbered rows: a trust section of the shop: what we see, what we keep, what cannot leak, as numbered rows.
- Payment instalments plan schedule: the provider offers pay-in-full or N payments: the chosen plan shows its dated schedule and any extra cost.
- Payment recovery actions list: a page of its own after a declined or failed payment: what happened, then up to three ways forward as stacked rows.
- Payment recovery inline banner: a compact banner above the payment form when recovery happens in place: it takes the focus so the message is read.
- Payment retry facts list: a payment that did not go through: the facts of the attempt, what happens next, retry or change the method.
- Payment trust line: directly under the pay button: one plain sentence and the accepted methods as chips.