# Paystack Module

https://docs.wisecp.com/en/paystack-module

Connect Paystack to offer clients its payment window and track the resulting invoice payments in WISECP.

## Reaching the Screen

Go to **Settings → Financial → Payment Gateways → All Modules** and click **Paystack**: `{admin}/modules/payment?module=Paystack`

## What Is on the Screen

The form contains separate test and live keys, a test switch and shared gateway settings. Clients pay in the Paystack window. This module offers no WISECP card storage, automatic payments, subscriptions, installment settings or gateway refunds.

## Before You Configure It

Use an activated Paystack merchant account for live payments and HTTPS for your site. This module accepts **NGN, USD, GHS and ZAR**; your account must also accept the chosen currency. Other currencies available at Paystack are outside this module's list.

Use a separate test system. There is no connection-test button; saving credentials does not verify a payment.

## Fields

- **Live Secret Key**: Required for live payments. Used to verify transactions and notification signatures; empty by default.
- **Live Public Key**: Required for the live payment window. Use the same account as the live secret key; empty by default.
- **Test Secret Key**: Required when Test Mode is enabled. Empty by default.
- **Test Public Key**: Required when Test Mode is enabled. Empty by default.
- **Test Mode**: Off by default. Enabled uses the test pair; disabled uses the live pair.

**Status** enables the module. Commission, currency conversion, amount limits and country restrictions are explained in [Payment Modules](https://docs.wisecp.com/en/payment-modules). **Callback URL**, **Success URL** and **Failed URL** are generated addresses, not editable settings.

## Tasks

### Configure the Keys

1. In Paystack Dashboard, open **Settings → API Keys & Webhooks**. Find the test and live sections. The eye icon reveals a secret after your account password.
2. In WISECP's Paystack form, enable **Status**. Copy each key to its matching field and enable **Test Mode**.
3. Click **Save Changes**. In **Payment Gateways → Initial → Enabled Module Selection**, select Paystack and click **Save Changes**.
4. The method becomes available subject to its amount, currency and country settings. Confirm it on a test invoice before making it available to clients.

### Register the Notification Address

1. Copy **Callback URL** from the WISECP Paystack form.
2. In Paystack **Settings → API Keys & Webhooks**, enter it in the matching environment's **Webhook URL** field and save that section.
3. The relevant payment event is `charge.success`. Its signature uses that environment's secret key; there is no separate webhook secret.
4. Check both the provider transaction and the WISECP invoice. The current module has a notification limitation described below.

### Test and Switch to Live

1. With test keys selected, open an unpaid test invoice as its client. Choose Paystack and click **Pay Now**.
2. Complete the payment with [Paystack test details](https://paystack.com/docs/payments/test-payments/). Keep the window open until the return finishes.
3. Compare the provider's successful transaction, currency and amount with the paid invoice. Check cancellation and a payment whose browser return is interrupted.
4. For live use, enter the activated account's live pair, clear **Test Mode** and click **Save Changes**. Subsequent payments use real funds.

### Refund a Payment

1. In Paystack **Transactions**, open the transaction, then **Refunds → New Refund**. Enter the amount and click **Confirm**.
2. Review the refund result in Paystack. WISECP cannot request or synchronize this refund.
3. For a fully refunded invoice, open `{admin}/invoices/detail?id={invoice}`. Under **Summary → Change Status**, select **Refunded** and **Add as expense**.
4. Click **Update Status**. This records the refund without sending money again. Record a partial refund for its actual amount separately.

## Things to Watch

> **Do Not Rely on the Webhook Alone**
> 
> The current module resolves the checkout before reading the notification's transaction reference. A webhook without the browser's invoice reference can leave payment unrecorded. Compare Paystack transactions with invoices before retrying a charge.

> **Keep the Return Window Open**
> 
> The alternate redirect path can fail if the popup cannot open. A success page alone is not proof of matching payment. Verify the reference, amount and currency before delivering a service or collecting again.

## Required Privileges

WISECP settings require **Modules → Payment Gateways** (`MODULES_PAYMENT_SETTINGS`). Invoice changes require **Billing → Edit** (`INVOICES_OPERATION`). Use Paystack's owner or administrator for key management and an account with refund access for refunds.

## Related Articles

- [Payment Modules](https://docs.wisecp.com/en/payment-modules)
- [Invoice Detail Overview](https://docs.wisecp.com/en/invoice-detail-overview)
- [Paystack Keys and Webhooks](https://support.paystack.com/en/articles/2123458)
- [Paystack Refunds](https://support.paystack.com/en/articles/2127106)
