WordPress
The Sanwo plugin adds payment checkout to any WordPress site. It supports shortcodes, a Gutenberg block, and a WooCommerce payment gateway.
Installation
Section titled “Installation”- Download sanwo.zip
- In your WordPress admin, go to Plugins → Add New → Upload Plugin
- Upload the zip file and click Install Now
- Activate the plugin
- Go to Settings → Sanwo to configure your provider and public key
Configuration
Section titled “Configuration”Navigate to Settings → Sanwo and set:
| Setting | Description |
|---|---|
| Provider | Payment provider (Paystack, Flutterwave, Razorpay, Monnify, Interswitch) |
| Public Key | Your provider’s public/publishable key |
| Default Currency | ISO currency code (default: NGN) |
| Debug Mode | Enable browser console logging |
Shortcode
Section titled “Shortcode”Use the [sanwo_checkout] shortcode anywhere — posts, pages, or widgets:
[sanwo_checkout amount="500000" button_text="Pay ₦5,000"]Shortcode attributes
Section titled “Shortcode attributes”| Attribute | Required | Default | Description |
|---|---|---|---|
amount |
Yes | — | Amount in minor units (kobo, cents) |
currency |
No | Settings value | ISO currency code |
email |
No | Logged-in user’s email | Customer email |
provider |
No | Settings value | Provider name |
key |
No | Settings value | Provider public key |
description |
No | — | Payment description |
button_text |
No | “Pay Now” | Button label |
button_class |
No | “sanwo-button” | CSS class for styling |
callback |
No | — | JS function name for result handling |
first_name |
No | — | Customer first name |
last_name |
No | — | Customer last name |
phone |
No | — | Customer phone number |
reference |
No | Auto-generated | Custom transaction reference |
Examples
Section titled “Examples”Basic payment button:
[sanwo_checkout amount="500000"]With custom text and description:
[sanwo_checkout amount="1000000" button_text="Subscribe — ₦10,000/mo" description="Monthly subscription"]Override provider per button:
[sanwo_checkout amount="500000" provider="flutterwave" key="FLWPUBK_TEST-xxxxx"]With customer details:
[sanwo_checkout amount="500000" first_name="John" last_name="Doe" phone="+2348012345678"]With JavaScript callback:
<script> function onPaid(result) { if (result.status === 'successful') { window.location.href = '/thank-you/'; } }</script>
[sanwo_checkout amount="500000" callback="onPaid"]Gutenberg block
Section titled “Gutenberg block”Search for Sanwo Checkout in the block inserter. Configure the payment in the block sidebar:
- Payment Settings — Amount, currency, email, description
- Provider Settings — Override the provider and public key per block
- Button — Customize the button text
The block uses your global settings for provider and public key by default.
WooCommerce
Section titled “WooCommerce”The plugin includes a WooCommerce payment gateway. When WooCommerce is active:
- Go to WooCommerce → Settings → Payments
- Enable Sanwo
- Click Manage to configure:
- Title and description shown at checkout
- Provider
- Public key
- Test mode toggle
Customers selecting Sanwo at checkout will be redirected to complete payment via the provider’s hosted UI. The plugin automatically converts WooCommerce amounts (major units) to minor units. On success, the order is marked as processing and the customer sees the order confirmation page.
Styling
Section titled “Styling”The plugin includes default button styles. Override them in your theme:
.sanwo-button { background: #your-brand-color; border-radius: 4px; padding: 14px 28px;}
.sanwo-button:hover { background: #your-hover-color;}Handling results
Section titled “Handling results”JavaScript events
Section titled “JavaScript events”The checkout button dispatches DOM events:
<script>document.addEventListener('sanwo:complete', function(e) { if (e.detail.status === 'successful') { // Redirect, show message, etc. }});</script>WooCommerce hooks
Section titled “WooCommerce hooks”// After a successful paymentadd_action('woocommerce_payment_complete', function($order_id) { // Your logic here});Requirements
Section titled “Requirements”- WordPress 5.8+
- PHP 7.4+
- WooCommerce 6.0+ (optional, for gateway)
Source code
Section titled “Source code”The plugin source is on GitHub: Sanwohq/wordpress