DocumentationDevelopersREST API

REST API

Four routes live under pay4payment/v1. Three serve the settings screen, which is a React app; the fourth prices the order-pay page for shoppers.

Free and ProUpdated for 3.0.0

Settings

GET  /wp-json/pay4payment/v1/settings
POST /wp-json/pay4payment/v1/settings

Capability manage_woocommerce. GET returns the stored settings of every known gateway, fee-enabled or not, plus the general settings. POST takes the same shape back and answers with the stored state after the save.

Saving never deletes what it was not sent: a payload that omits a gateway leaves that gateway alone, and a tier the payload does not mention survives. To replace a method’s rule list wholesale — reorder, remove — the Pro editor sends replaceTiers: true in the envelope with the complete, ordered list. The free editor never sends it.

Condition values are stored as ids and slugs, never labels; the conditions page lists the shape per type.

Condition options

GET /wp-json/pay4payment/v1/condition-options

One payload with everything the rules builder’s pickers show, each entry as { value, label } with the value the evaluator expects: coupons (capped at 100 — type a code the list does not show, it is still valid), shipping methods qualified by zone, shipping zones, shipping classes, countries with their states, roles, and product categories.

Product search

GET /wp-json/pay4payment/v1/condition-products?search=term
GET /wp-json/pay4payment/v1/condition-products?include=12,34

Products and variations searched on demand, capped at 20 results; include re-hydrates labels for stored ids so a saved rule shows names rather than numbers, and wins over search when both are sent.

Order-pay preview

GET /wp-json/pay4payment/v1/order-pay-preview?order_id=&key=&gateway=

Pro. What the order total would be if the customer paid this order with that gateway — the figure the pay-for-order page shows beside each method. It is authorised by the order key, the same credential the pay link carries, so it works for guest orders and needs no login. Read-only, never cached.

Authentication

The three admin routes need a logged-in user with manage_woocommerce and a REST nonce (or application-password auth from outside). The preview route needs only the order key. There are no public write routes.

Need a hook that isn't here? Open an issue — filters get added when there's a real case for them.

Suggest a feature