# Payments

> Connect your Stripe and PayPal accounts with their keys (webhooks are set up for you) and switch a funnel from test to live payments.

Payments go to **your own** Stripe and PayPal accounts. Advent Funnel keeps their keys encrypted, uses them to take payments and refunds, and never shows a saved key again, only its last 4 characters.

## Connect a payment account

Open **Settings → Payments** and add an account. Each account has its **test** keys and its **live** keys:

| | Stripe | PayPal |
| --- | --- | --- |
| Public key | Publishable key (`pk_test_…` or `pk_live_…`) | Client ID |
| Secret key | Secret key (`sk_…`, or a restricted `rk_…`) | Client secret |
| Webhook | The endpoint's signing secret (`whsec_…`) | The webhook ID |

Only the live keys are needed to take real payments: the test keys and the webhook fields are folded away under **Test mode** and **Advanced**. [Find your payment keys](https://docs.adventfunnel.com/payment-keys) shows where Stripe and PayPal keep them.

One account per provider can be the **default**: new funnels start on it. Keep each business's accounts separate.

## Add the webhooks

A webhook is how Stripe or PayPal tells Advent Funnel a payment went through, so it decides whether an order is paid.

When you save an account's keys, Advent Funnel adds its webhook in your Stripe or PayPal account for you, in test and in live, so there's nothing to copy. If it can't (for example, a restricted Stripe key without permission to manage webhooks), the Payments page says why and offers **Set up the webhook** to try again.

To add one by hand instead, use the address each account shows for test and for live on the Payments page, with these events:

- **Stripe**: `payment_intent.succeeded`, `refund.created`, `refund.updated` and `refund.failed`.
- **PayPal**: `PAYMENT.CAPTURE.COMPLETED` and `PAYMENT.CAPTURE.REFUNDED`.

Then paste the signing secret (Stripe) or webhook ID (PayPal) into the account.

If a Stripe webhook doesn't arrive, the order isn't lost: Advent Funnel asks Stripe about pending payments every 10 minutes and marks them paid. **Settings → Webhooks** lists every webhook request it got, including refused ones (for example, a signature that doesn't match the secret), so you can see what went wrong.

## Test and live payments

Each funnel picks its Stripe and PayPal accounts in its settings, and takes either **test** or **live** payments:

- New funnels, and copies of funnels, start in **test** mode. Its checkout, upsell and downsell pages say "Test mode — no real charges" at the top, and real cards are declined.
- Orders paid in test mode are test orders: they don't count in your numbers or go to the ad platforms.
- **Go live** is on the funnel's settings. It's allowed once the funnel's accounts have live keys and its launch checklist has nothing left to do. Switching back to test is always allowed.

Every switch is logged with who made it. A badge beside the funnel's name shows **Test payments** or **Live payments**, so you always know which it takes.

> An order keeps the account and mode it was paid with. Its refunds and upsell use those keys, even after the funnel goes live or moves to another account.

## Apple Pay and Google Pay

Apple Pay and Google Pay show only on domains registered with the Stripe account taking the payment. Advent Funnel registers each funnel's live domain with its Stripe account by itself: when the domain goes live, when the account changes, and each day for any that isn't ready yet. The funnel's **Domain** tab shows where it stands. See [Domains](https://docs.adventfunnel.com/domains).

## Order emails

Order confirmations are sent from the funnel's support email (or your store's, set in Brand defaults). The Brand settings have **Send me a test email**, which shows whether the sender works before customers miss their confirmations.
