Skip to content

WordPress

The Sanwo plugin adds payment checkout to any WordPress site. It supports shortcodes, a Gutenberg block, and a WooCommerce payment gateway.

  1. Download sanwo.zip
  2. In your WordPress admin, go to Plugins → Add New → Upload Plugin
  3. Upload the zip file and click Install Now
  4. Activate the plugin
  5. Go to Settings → Sanwo to configure your provider and public key

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

Use the [sanwo_checkout] shortcode anywhere — posts, pages, or widgets:

[sanwo_checkout amount="500000" button_text="Pay ₦5,000"]
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

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"]

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.

The plugin includes a WooCommerce payment gateway. When WooCommerce is active:

  1. Go to WooCommerce → Settings → Payments
  2. Enable Sanwo
  3. 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.

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;
}

The checkout button dispatches DOM events:

<script>
document.addEventListener('sanwo:complete', function(e) {
if (e.detail.status === 'successful') {
// Redirect, show message, etc.
}
});
</script>
// After a successful payment
add_action('woocommerce_payment_complete', function($order_id) {
// Your logic here
});
  • WordPress 5.8+
  • PHP 7.4+
  • WooCommerce 6.0+ (optional, for gateway)

The plugin source is on GitHub: Sanwohq/wordpress