ORBCART DOCUMENTATION
Express checkout
Apple Pay, Google Pay and PayPal buttons right in the bag. Buy without filling in a form.
An express button skips the checkout form. The wallet supplies the address and contact, OrbCart quotes each step, and the buyer pays in the sheet.
<Checkout> shows express buttons automatically for every method that supports them. This page
is for buttons elsewhere, such as in the bag or on a product page.
Two kinds of express
| Mode | Methods | How it works |
|---|---|---|
sheet | Apple Pay, Google Pay | The buyer picks address and card in the wallet sheet and pays there. |
review | PayPal | The buyer approves at PayPal, then confirms on your review page. |
cart.paymentMethods tells you which methods offer express: their express
field is "sheet" or "review".
In React
ExpressCheckout shows the provider's own button for every express method of
the Cart, follows the purchase and says what went wrong in the buyer's language:
import { useNavigate } from "react-router";
import type { Cart, CommerceCart } from "@orbcart/client";
import { ExpressCheckout } from "@orbcart/react";
export function BagExpress({ cart, current }: { cart: CommerceCart; current: Cart }) {
const navigate = useNavigate();
return (
<ExpressCheckout
cart={cart}
initial={current}
locale="en-GB"
returnTo="/en/checkout"
onReviewed={({ preparation }) => navigate(`/en/checkout?preparation=${preparation}`)}
onOrdered={(order) => navigate(`/orders/${order.token}`)}
/>
);
}onOrderedgets each Order once. Show your confirmation page.onReviewedtakes PayPal's approval to your checkout page. The checkout there finds?preparation=in the address and shows the review by itself. WithoutonReviewed, only the wallets that pay in their sheet are offered.returnTois that page. A buyer PayPal redirects instead of using its popup comes back there, in the language they shopped in.pendingkeeps the buttons waiting while a change of the bag is on its way, so a sheet never shows the old total.paymentOptions={{ appearance: "inherit" }}dresses the buttons in your theme as they appear, as on the checkout.
For markup of your own, useExpressCheckout gives you the methods and a mount
function, and ExpressButton renders one provider's button.
Without React
const button = await cart.mountExpress("apple_pay", element, {
accepted: (result) => {
if (result.status === "ordered") showConfirmation(result.order.number);
},
reviewed: (review) => goToReviewPage(review.preparation),
failed: (error) => console.error(error),
});
if (!button.available) hideWalletSection();accepted receives the same outcomes as quote.pay().
3-D Secure in a wallet
Some banks ask for 3-D Secure even after Apple Pay or Google Pay. OrbCart opens the challenge in a dialog above the page, so the buyer never loses sight of it. Nothing to build.
Setup checklist
- Apple Pay with Stripe: register your domain as a payment method domain in Stripe.
- Apple Pay with Adyen: serve Adyen's domain file at
/.well-known/apple-developer-merchantid-domain-associationastext/plain, and test with an Apple sandbox tester. - Google Pay: nothing extra in test. In live, Google requires your merchant registration.
- Content Security Policy: allow
pay.google.comand Apple's Pay SDK. - HTTPS: wallets only show on secure origins.
localhostcounts as secure.
Testing Apple Pay
Stripe test cards cannot be added to Apple Pay. Use a real card in your wallet with Stripe's test keys: Stripe creates a test token and charges nothing.