Rebasely Beta: data may be purged

examples/storefront Public

TypeScript · 15 lines · 850 B · at e83464e

// Payments, behind the two calls checkout and expiry need. In production this is the payments// Worker's PaymentsService over the PAYMENTS service binding (workers/payments); tests pass their// own. storefront-api does not talk to Stripe or hold its secret key.export type Charge = { order_id: string; amount_cents: number; currency: string; email: string };export type Intent = { id: string; client_secret: string };export interface Payments {  // Creates the PaymentIntent the shopper pays in the browser. Calling it again for the same  // order returns the same intent.  createIntent(charge: Charge): Promise<Intent>;  // True when the intent is cancelled, false when it can no longer be (it succeeded, or a  // payment is processing). In that case the webhook settles the order.  cancelIntent(intentId: string): Promise<boolean>;}