# Take online payments with Paystack

Connect your Paystack account so customers can pay for bookings online through Paystack's checkout, refunds can be sent back through Paystack, and Finance → Takings can check what Paystack took. You need a Paystack business account and its secret key; live keys only work once Paystack has activated your business.

Source: https://help.pigi.io/guides/integrations/payments/paystack

## Quick answers

**Which Paystack keys does PiGi need?**
The **Secret Key** is required. It starts with `sk_test_` in test mode and `sk_live_`
in live mode. The **Public Key** is optional and only used for an inline popup.

**Where do I find my Paystack keys?**
Sign in to the Paystack Dashboard, open **Settings** and click the **API Keys &
Webhooks** tab. Test keys are under "API Configuration - Test Mode" and live keys
under "API Configuration - Live Mode".

**Why can't I get Paystack live keys?**
Paystack only lets you switch to Live Mode once your business account has been
activated, which includes submitting documents such as proof of address. Use test
keys in PiGi's Sandbox credentials until then.

**Do I need to paste a webhook URL into Paystack?**
Not to take payments. PiGi confirms each payment with Paystack when the customer
returns from Paystack's page, and checks the progress of refunds with Paystack every
hour on its own.

**Can I refund a Paystack payment from PiGi?**
Yes — the full amount or part of it, for payments made through PiGi's online
checkout. Switch on **Enable Programmatic Refunds** under the gateway's **Refunds**
row first. Paystack refunds are not instant: the refund shows as processing in PiGi
until Paystack confirms it, and Paystack says customers can expect the money within
3 to 10 working days.

**Can PiGi show me what Paystack took?**
Yes. Finance → Takings has a Paystack check that lists the charges on your Paystack
account using the same secret key, so you can match them against payments recorded in
PiGi. No extra key is needed.

**A customer paid on Paystack but the booking says unpaid. Why?**
PiGi marks a Paystack booking paid when the customer comes back from Paystack's page.
If they closed the page first, the payment shows on the Takings Paystack check as
unrecorded — record the payment against the booking.

**Which currencies can Paystack take?**
PiGi treats Paystack as taking ZAR, NGN, GHS, KES and USD. A booking in another
currency is charged in USD at the rate set under Finance → Currency rates.

## What this does

Connecting Paystack lets customers pay for bookings and gift vouchers on Paystack's
checkout page and come back to PiGi with the payment recorded. PiGi can also send
full or partial refunds through Paystack and list what Paystack took on Finance →
Takings.

You need a Paystack business account. Paystack charges per transaction — see
Paystack's pricing page for your country. PiGi does not add Paystack's fee to the
customer's total.

## Before you start

- The **admin** role on your company in PiGi.
- A Paystack account. For real payments it must be activated by Paystack.

## Set up Paystack

1. Sign in to the Paystack Dashboard and open **Settings → API Keys & Webhooks**.
2. Under "API Configuration - Test Mode", copy the **Test Secret Key** (`sk_test_…`)
   and, if you want it, the Test Public Key.
3. Once your business is activated, scroll to "API Configuration - Live Mode" and
   copy the **Live Secret Key** (`sk_live_…`).
4. Keep the secret keys private — anyone holding one can act on your Paystack
   account.

## Connect it to PiGi

1. Open **Company → Settings → Finance → Payment Gateways**, click **Connect** on the
   Paystack card, then **Connect Paystack**. The credentials dialog opens.
2. On the **Sandbox** tab, paste the test key into **Secret Key** and click **Save
   credentials**.
3. Click **Verify sandbox connection**. "Credentials verified successfully" means
   Paystack accepted the key.
4. On the **Production** tab, paste the live key, click **Save credentials**, then
   **Verify production connection**.
5. Turn on **Offer at booking checkout** in the Paystack sheet. For invoice "Pay Now"
   links, also tick Paystack under Invoicing → Settings → Online Payments.
6. To refund through Paystack, open **Refunds**, switch on **Enable Programmatic
   Refunds** and click **Save**.
7. When you're ready for real money, click **Production** on the Sandbox |
   Production switch in the Paystack sheet and confirm with **Go live**.

The rest of the screen is covered in
[Connect a payment gateway](../company-setup/payment-gateways.md).

## Test it

1. With Paystack on **Sandbox** and offered at checkout, make a booking on your public
   booking page and choose Paystack.
2. Pay with one of the test cards Paystack lists in its test-payments documentation.
3. Confirm the booking shows the payment in PiGi and the transaction appears in your
   Paystack Dashboard while it is in Test Mode.
4. Refund it from PiGi and watch the refund move from processing to completed.

## Troubleshooting

| Message | Fix |
|---|---|
| "Secret Key is required" / "Secret key is required" | Enter the secret key. |
| "Test keys cannot be used in production environment" | Put the `sk_live_` key in the Production credentials. |
| "Live keys should not be used in sandbox environment" | Put the `sk_test_` key in the Sandbox credentials. |
| "Invalid credentials - authentication failed" | The key is wrong, revoked, or is the public key. Copy the secret key again from API Keys & Webhooks. |
| "Could not connect to payment gateway" / "Connection timed out - gateway may be unavailable" | Paystack could not be reached. Try again later. |
| "No EUR→USD exchange rate is set, so this payment can't be converted…" (with your currencies) | Add the missing rate under Finance → Currency rates. |
| Refund dialog: "Programmatic refunds are not enabled for paystack." | Switch on **Enable Programmatic Refunds** under Refunds. |

## Known limitations

- A booking is only marked paid automatically when the customer returns from
  Paystack's page. Use the Takings Paystack check to catch payments where they did
  not.
- Refunds take days to settle; PiGi shows them as processing until Paystack confirms.
- Saved keys are never shown back to you. If you lose one, copy it again from Paystack.

## Sources

- [Paystack — API keys and webhooks](https://support.paystack.com/en/articles/2123458)
- [Paystack — initiating and completing a refund](https://support.paystack.com/en/articles/2127106)
