McTaba Labs logo
Bonaventure OgetoBy Bonaventure Ogeto|

Paystack with Saleor

Saleor payment gateways are Python plugins implementing the GatewayPlugin interface. Build a PaystackGatewayPlugin class with process_payment() (calls POST /transaction/initialize and returns ClientToken with the authorization_url), confirm_payment() (calls GET /transaction/verify), and optionally refund() (calls POST /refund). Register the plugin in PLUGINS setting in saleor/settings.py.

Saleor Paystack Gateway Plugin Structure

# saleor/payment/gateways/paystack/__init__.py
import requests, hmac, hashlib
from saleor.payment.interface import GatewayConfig, GatewayResponse, PaymentData

PAYSTACK_API = 'https://api.paystack.co'

def process_payment(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:
    secret_key = config.connection_params['secret_key']
    resp = requests.post(
        PAYSTACK_API + '/transaction/initialize',
        json={
            'email': payment_information.customer_email,
            'amount': int(payment_information.amount * 100),  # to minor unit
            'reference': payment_information.token,
            'currency': 'NGN',  # or from config
            'callback_url': config.connection_params['callback_url'],
        },
        headers={'Authorization': 'Bearer ' + secret_key},
    )
    data = resp.json()
    return GatewayResponse(
        is_success=data['status'],
        client_token=data['data']['authorization_url'],  # storefront redirects here
        transaction_id=data['data']['reference'],
        amount=payment_information.amount,
        currency=payment_information.currency,
        error=data.get('message') if not data['status'] else None,
    )

def confirm_payment(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:
    secret_key = config.connection_params['secret_key']
    resp = requests.get(
        PAYSTACK_API + '/transaction/verify/' + payment_information.token,
        headers={'Authorization': 'Bearer ' + secret_key},
    )
    data = resp.json()
    success = data['data']['status'] == 'success'
    return GatewayResponse(
        is_success=success,
        transaction_id=payment_information.token,
        amount=data['data']['amount'] / 100,
        currency=data['data']['currency'],
        error=None if success else data['data'].get('gateway_response'),
    )

Registering the Plugin in Saleor

# saleor/settings.py
PLUGINS = [
    # ... other plugins
    'saleor.payment.gateways.paystack.PaystackGatewayPlugin',
]

# In your PaystackGatewayPlugin class:
class PaystackGatewayPlugin(BasePlugin):
    PLUGIN_NAME = 'Paystack'
    PLUGIN_ID = 'paystack'
    CONFIG_STRUCTURE = {
        'secret_key': {'label': 'Secret Key', 'type': 'secret'},
        'callback_url': {'label': 'Callback URL', 'type': 'string'},
    }
    DEFAULT_ACTIVE = False

After registering, go to Saleor Dashboard → Plugins → Paystack to enter your secret key and callback URL. Activate the plugin and assign it to your channels.

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

Learn More

Key Takeaways

  • Saleor payment gateways are Python plugins — implement the GatewayPlugin interface.
  • process_payment() initializes the Paystack transaction and returns the checkout URL as a client token.
  • confirm_payment() is called after the customer returns from Paystack — it verifies the transaction.
  • Store the Paystack secret key in Saleor's plugin configuration (encrypted in the database).
  • Webhook events from Paystack can update Saleor order status via the Saleor order management API.

Frequently Asked Questions

Does Saleor have an official Paystack payment gateway?
Saleor does not have an official Paystack gateway as of 2026. You need to build a custom plugin following the GatewayPlugin interface. The code pattern above gives you a working starting point. Check the Saleor community forums and GitHub for any community-maintained Paystack plugins that may have been published.
How do I handle Paystack webhooks in Saleor?
Create a Django view or Saleor webhook endpoint that receives Paystack events. On charge.success, call the Saleor order management API (or internal service) to mark the payment as confirmed. Alternatively, your Saleor plugin can expose a webhook endpoint that Saleor routes to from its webhook handler system.
What Saleor version is this compatible with?
The plugin structure shown works with Saleor 3.x. Saleor's payment plugin API has evolved across versions — check the Saleor developer docs for your specific version. The core approach (process_payment, confirm_payment) is consistent across 3.x but method signatures may differ.

Learn Paystack Integration

KES 2,999

The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.

Start Paystack Course

Not ready? Create Free Account