# Connect a payment gateway

Payment Gateways is where you connect Yoco, Paystack, PayFast, PayGenius or PayPal to your company. Each gateway's sheet holds its keys, an "Offer at booking checkout" switch, its own Sandbox | Production switch with a "Go live" confirmation, and its fees, currencies and amount limits.

Source: https://help.pigi.io/guides/company-setup/finance/payment-gateways

## Quick answers

**Where do I connect a payment gateway?**
Company → Settings → Finance → Payment Gateways, at
/school/admin/company/settings/finance/payment-gateways. Saving requires the company
admin role.

**Which gateways can I connect?**
The gateways PiGi has made available on the platform. The standard list is Paystack,
PayGenius, PayFast, Yoco and PayPal. Each has its own end-to-end setup guide: Take
online payments with Yoco, Paystack, PayFast, PayGenius or PayPal.

**How do I let customers pay with a gateway when they book online?**
Open the gateway with **Configure** and switch on **Offer at booking checkout** at the
top of its sheet. The switch is greyed out ("Add sandbox keys first." or "Add
production keys first.") until keys are stored for the environment the gateway is in.
Turning it on also switches the gateway on.

**Why does my gateway card say "Not at checkout"?**
The gateway is connected but not offered to customers. Below the badges the card says
"Connected, but customers can't pay with it yet." with an **Offer at checkout** button —
click it, or use the **Offer at booking checkout** switch in the gateway's sheet. If the
card says "Add keys to offer it to customers." instead, click **Add keys** first. Once
offered, the badge reads "At checkout".

**I connected a gateway but customers can't pay with it. Why?**
Check three things. The gateway must be offered at booking checkout (the card says "At
checkout"). It must have keys for the environment it pays in. And its last Verify must
not have failed — checkout hides a gateway whose keys were rejected until you save new
ones. Invoice "Pay Now" links are separate: tick the gateway at Invoicing → Settings →
Online Payments.

**How do I switch one gateway to live payments?**
Open the gateway with **Configure** and click **Production** on the Sandbox | Production
switch under the checkout switch. PiGi asks "Take live payments through …?" and warns
that customers will be charged for real; click **Go live**. Only that gateway changes —
"Other gateways are not changed." Production is greyed out until production keys are
stored.

**Why is Production greyed out on my gateway?**
Either no production keys are stored yet (the hint says "Add production keys under
Credentials first."), or you are on a PiGi test system ("Only on the live site — dev
and staging always use sandbox.").

**What is the Sandbox / Production toggle in the page header?**
It switches your company's mode and every connected gateway at once, without a
confirmation, and confirms with "Switched to Production mode" or "Switched to Testing
mode". It appears on the live PiGi site only; test systems show a "Sandbox
(non-production environment)" pill instead. To move one gateway, use the switch in its
own sheet.

**What do I need to enter for Yoco?**
Only the **Secret Key** is required. The **Public Key** is optional. The **Business
API Key** is also optional and is used only by Finance → Takings to read what Yoco
took. The secret key must start with `sk_test_` for sandbox or `sk_live_` for
production — Verify rejects a test key used in production and a live key used in
sandbox. See Take online payments with Yoco for where to find each key.

**What do I need to enter for the other gateways?**
Paystack: Secret Key (required) and Public Key. PayFast: Merchant ID, Merchant Key
and Passphrase (all required). PayGenius: Access Token and Secret Key (both
required). PayPal: Client ID and Client Secret (both required). Each gateway's own
guide says where to find them.

**Why does my gateway card say "Missing credentials"?**
No API keys are stored for the environment the gateway is currently set to. Click
the "Missing credentials" badge — it opens the gateway's credentials dialog
directly.

**How do I tell whether my keys are actually saved?**
Open the gateway with **Configure**, click **Update credentials**, and pick
**Sandbox** or **Production** on the switch. Stored keys are listed one per row
with either a masked value (meaning a key is stored) or "Not set" with an **Add**
link. The environment marked **In use** is the one payments go through. PiGi never
shows the key itself back to you.

**I saved live keys under Sandbox by mistake. How do I clear them?**
Open the credentials dialog, pick the environment, and click **Remove keys**. PiGi
asks "Remove sandbox keys?" (or production) and deletes only that environment's keys.

## What this is

Company → Settings → Finance → Payment Gateways lists your gateways in two groups,
**Connected (n)** and **Available (n)**. Each connected gateway opens a sheet that says
whether it is on, whether customers can pay with it, which keys it uses, and whether
those are test or live keys. For signing up with a provider and finding its keys, use
that provider's own guide; this guide covers the screen.

## Before you start

- You need the **admin** role for the company.
- Have a merchant account with the gateway and its API keys ready. Use test keys
  first — most gateways issue separate test and live keys.

## Steps

1. Open **Company → Settings → Finance → Payment Gateways**.
2. Click **Connect** on a card under Available (or **+ Gateway** in the header and pick
   one). The gateway sheet opens with "Connect …, then add its keys and offer it at
   checkout."
3. Click **Connect …**. The gateway is created switched on, not offered at checkout, and
   the credentials dialog opens.
4. In the credentials dialog, pick **Sandbox** or **Production** (the one payments use
   is marked **In use**), fill in the fields and click **Save credentials**.
5. Click **Verify sandbox connection** or **Verify production connection** (**Verify
   again** once connected). On success the status pill reads "Connected"; on failure it
   reads "Failed to connect" and the gateway's own message is shown.
6. Back on the sheet, switch on **Offer at booking checkout**.
7. When you are ready to take real money, store production keys, verify them, then
   click **Production** on the sheet's Sandbox | Production switch and confirm with
   **Go live**.
8. For invoice "Pay Now" links, also tick the gateway at Invoicing → Settings → Online
   Payments.
9. Order connected gateways with the chevrons on each card — the order carries through
   to the checkout list.

## The gateway sheet

The sheet opens with your school and the gateway's logo, then status badges
(**Active** or **Inactive**, **Default**, **No credentials**) and two switches:

| Switch | What it does |
|---|---|
| **On** | "Off stops every payment through …". Switching it off also stops offering it at checkout. |
| **Offer at booking checkout** | "Customers can pay with it when they book online." Needs keys for the current environment. |

Below them, the Sandbox | Production switch reads "Test payments only — nothing is
charged" or "Taking live payments with production keys".

The action list holds **Add credentials** / **Update credentials**, **Settings**
(Custom Display Name, Active, Set as default, Priority / order — saved with **Save
settings**), **Refunds** (Enable Programmatic Refunds, or "Manual" for a gateway that
cannot refund), **Restrictions & fees** (Allowed Currencies, Allowed Payment Methods,
Minimum Amount, Maximum Amount, Percentage Fee (%), Fixed Fee) and **Remove …**.

## Known limitations

- **Connecting is not offering.** A new gateway is on but not at checkout until you
  switch on **Offer at booking checkout**. Invoice "Pay Now" uses a separate list at
  Invoicing → Settings → Online Payments.
- **The card's Test mode / Live badge follows the page-header toggle,** not the
  gateway's own switch. After moving one gateway with **Go live**, trust the sheet.
- **The page-header toggle moves every gateway at once** and does not ask first.
- **Saved keys are shown as a mask, never as a value.** If you have lost a key, reissue
  it at the gateway.
- **The status pill tracks the environment in use.** Verifying the other environment
  tells you whether those keys work but does not change the pill.
- **A gateway with no keys, or a failed Verify, is hidden from checkout.** Saving new
  keys clears the failure.
- **Fee fields are records, not behaviour.** PiGi does not add them to a customer's
  total.
- **Removing a gateway** deletes the whole configuration, keys included.

## Related

- [Take online payments with Yoco](../integrations/yoco.md)
- [Take online payments with Paystack](../integrations/paystack.md)
- [Take online payments with PayFast](../integrations/payfast.md)
- [Take online payments with PayGenius](../integrations/paygenius.md)
- [Take online payments with PayPal](../integrations/paypal.md)
- [Invoice settings](invoicing-settings.md) — the Online Payments list for invoice
  "Pay Now"
- [Find your Finance settings](finance-settings.md)
- [Set up your bank details](bank-details.md) — for customers paying by EFT instead
