# Payments — online payments (Stripe)

> Cards and PromptPay through Stripe Checkout for the Shop, Donations, Courses and your own code, confirmed by a signed webhook

Source: https://anasaki.live/docs/en/store/plugin-payments

The **Payments** plugin (`payments`) connects **Stripe Checkout** (cards, and PromptPay on Stripe Thailand accounts). Needs 2.5.0 or later.

## Settings

1. **Stripe secret key** (`sk_live_…`, or `sk_test_…` to try it) — stored encrypted
2. **Site code → Settings → allowed hosts**: add `api.stripe.com`
3. In Stripe → Developers → Webhooks add the endpoint `https:///payments/stripe/webhook` with `checkout.session.completed` and `checkout.session.async_payment_succeeded`, then paste its **Signing secret** (`whsec_…`)
4. Choose the **payment methods**: cards, or cards and PromptPay

## With the other plugins

- **Shop** — a **Card** payment method: customers pay on Stripe's page and the order becomes **Paid** by itself; if the page cannot open, the order waits with a pay-again button
- **Donations** — **Give by card**, confirmed with its receipt automatically
- **Courses** — buy a course by card and study at once

A payment counts only when its amount matches, and each one is confirmed once. The **Online payments** admin page lists them.

## For developers

```ts
const { url } = plugins.call('payments', 'checkout', { ref: 'site:' + code, amount: 500, description: 'Sign-up fee',
  successPath: '/thanks', cancelPath: '/apply' });
site.on('payments.paid', (p) => { /* p.ref, p.amount, p.currency, p.sessionId */ });
```
