Skip to content

WooCommerce Plugin

Spayon for WooCommerce connects a WooCommerce store to Spayon using an offsite checkout flow: the plugin creates a Spayon payment session for each order, redirects the customer to the hosted Spayon payment page, then updates the WooCommerce order when Spayon sends a signed callback.

Overview

For every order paid with Spayon, the plugin:

  1. Requests a Bearer token from POST /api/tokens.
  2. Creates a session with POST /api/product/session using the order's amount and currency.
  3. Redirects the customer to the returned session_url.
  4. Receives a signed callback from Spayon and updates the order status.
  5. Falls back to polling GET /api/product/session/{id} when the customer returns to the store.

What You Need

  • A WordPress site with WooCommerce installed
  • A Spayon vendor account
  • Your Client ID and Client Secret (from the Vendor Admin Panel)
  • A production site served over HTTPS

TIP

Production callbacks must use HTTPS. In Sandbox, HTTP is also accepted.

Install the Plugin

  1. Download the plugin ZIP provided by Spayon.
  2. In WordPress admin, go to Plugins → Add New → Upload Plugin.
  3. Upload the ZIP file and activate the plugin.
  4. Go to WooCommerce → Settings → Payments.
  5. Find Spayon for WooCommerce and click Manage.

Configure the Plugin

FieldSourceNotes
Client IDVendor Admin PanelUsed to obtain Bearer tokens
Client SecretVendor Admin PanelUsed for API authentication
Callback SecretOptionalUsed to verify the X-Signature on callbacks. Leave empty to use the Client Secret.
Default Payment MethodOptionalPre-selects a method: visamaster or mir
Available MethodsOptionalComma-separated list, e.g. visamaster,mir
Payment Page LanguageOptionalen, hy, or ru

Callback Secret

Spayon currently signs callbacks with your Client Secret. Leave the Callback Secret field empty and the plugin verifies callbacks with the Client Secret automatically. Only set Callback Secret if Spayon issues you a separate one in a future release — and if you do, it must match exactly, or callbacks fail with 401 invalid_signature.

Currency

The plugin forwards the WooCommerce order currency to Spayon. Only enable this gateway for currencies Spayon supports: AMD, RUB, USD, EUR, GBP. Orders in any other currency are rejected at session creation.

Callback and Return URLs

The plugin registers these REST routes on your store automatically:

URLPurpose
https://your-store.com/wp-json/spayon/v1/callbackReceives signed payment callbacks (POST)
https://your-store.com/wp-json/spayon/v1/returnLands the returning customer and polls session status (GET)

Both must be reachable from the public internet.

How the Flow Works

  1. The customer selects Spayon at checkout.
  2. The plugin requests a Bearer token from Spayon.
  3. The plugin creates a payment session and stores session_id on the order.
  4. The customer is redirected to the hosted Spayon payment page.
  5. Spayon sends a signed callback to the store's callback URL.
  6. The plugin verifies the X-Signature (HMAC SHA256) and updates the order.
  7. When the customer returns, the plugin also polls the session status as a fallback.

See Callbacks & Returns for the signature scheme and payload details.

Order Status Mapping

Spayon statusPlugin actionMerchant-visible result
paidCalls payment_complete()Order moves to the paid / processing flow
pendingKeeps order on holdOrder waits for a later callback or return poll
failedAdds a failure noteOrder is not marked successful; status is left unchanged
expiredAdds an expiry noteOrder is not marked successful; status is left unchanged

Failed and expired sessions

The plugin intentionally leaves the order status unchanged on failed or expired so a customer can retry without the order being force-cancelled. Review such orders manually and cancel them in WooCommerce if needed.

Troubleshooting

Spayon API errors

Where it happensTechnical errorMeaningWhat to check
Token requestspayon_missing_credsClient ID or Client Secret missingEnter both credential fields and save
Token requestspayon_token_errorCould not get a Bearer tokenCheck Client ID, Client Secret, and outbound HTTPS access
Session creationspayon_session_errorSpayon rejected the sessionCheck request fields, currency support, and available methods
Session status pollingspayon_status_errorCould not fetch session statusCheck the stored session ID and token flow

Callback and return errors

EndpointResultMeaningMost likely cause
Callback401 invalid_signatureSignature verification failedWrong secret, a Callback Secret set that does not match what Spayon signs with, wrong URL, or copied spaces
Callback404 order_not_foundValid callback but no matching orderWrong order ID, missing stored session ID, or unknown order
Return500 token_errorCould not authenticate to poll statusWrong or missing API credentials
Return404 order_not_foundReturn URL reached but no order matchedBroken return parameters or missing session mapping

Customer pays but the order stays pending

  • Check whether the callback reached the site (look for a Spayon order note).
  • Check whether the callback signature passed — a 401 means the secret does not match. Leave Callback Secret empty so the plugin uses the Client Secret.
  • Check whether the return poll fetched the session status successfully.

Go-Live Checklist

  • [ ] Plugin installed and activated
  • [ ] Payment method enabled in WooCommerce
  • [ ] Client ID and Client Secret entered
  • [ ] Callback Secret left empty (recommended) — the plugin then uses your Client Secret automatically
  • [ ] Callback URL reachable from the public internet
  • [ ] HTTPS enabled on the production site
  • [ ] A test payment completed successfully