Search by

paylexer / wordpress-starter

paylexer

Starter WordPress plugin that takes payments through the PayLexer plugin's developer API. Generate it, rename it, make it yours.

Package info

github.com/PayLexer/wordpress-starter

Type:project

pkg:composer/paylexer/wordpress-starter

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-11-04 06:37 UTC

This package is auto-updated.

Last update: 2026-11-04 06:38:19 UTC


README

A small working plugin that takes payments through the PayLexer plugin's developer API, built on a platform adapter (PayLexer\Integration\PlatformAdapter). Generate a copy, rename it, then change it to fit your site.

It doesn't talk to PayLexer itself and holds no keys. The merchant connects their account once in the PayLexer plugin, and your plugin uses that connection:

  • src/Adapter.php is your platform: its id, name and features, and on_event(), where verified webhooks arrive. It's registered on paylexer_init with paylexer_register_adapter() and can take payments while your plugin is active.
  • Settings → PayLexer Starter shows the connection, your plugin's settings (test mode, default gateway), the merchant's gateways, and your orders and subscriptions with refund and cancel buttons. Every panel is one Adapter call you can copy.
  • src/Payments.php takes one-time payments and subscriptions through PayLexer's hosted checkout (CheckoutRequest, SubscriptionRequest). Failures throw PayLexer\Integration\Exception. Whether checkout opens in a modal or as a redirect is PayLexer's decision per gateway.
  • PayLexer checks each webhook's signature, then calls Adapter::on_event(). Settle your orders there, never from the browser.

You can only see and refund orders and subscriptions your own plugin created.

Create your plugin

cd wp-content/plugins
composer create-project paylexer/wordpress-starter acme-pay

You're asked for the plugin name, slug, prefix and namespace, with defaults from the folder name (Acme Pay, acme-pay, acme_pay, AcmePay). You're also asked for the platform you integrate (e.g. acme-bookings / "Acme Bookings"), which is what PayLexer records on orders and lists under Integrations. Add --no-interaction to accept the defaults.

Try it

  1. Install and connect the PayLexer plugin, and enable at least one gateway.
  2. Activate your plugin.
  3. Put [acme_pay_pay amount="10.00" currency="USD" description="T-shirt"] on a page and pay with a sandbox card. Add interval="month" for a subscription, and optionally interval_count, trial_days, sign_up_fee and billing_cycles. Gateways that can't run a trial or charge a sign-up fee are left out of the list.
  4. Refund from Settings → PayLexer Starter, or from code with AcmePay\Adapter::instance()->refund( $order_reference ), where $order_reference is the one create_checkout() returned.

PayLexer delivers webhooks to the site's own domain, so a local site needs a tunnel.

Make it yours

src/Payments.php stores its orders in a WordPress option so the template runs on its own; replace that with your own orders. Everything to change is marked TODO. Webhooks arrive in Adapter::on_event(): payment events settle one-time orders, and subscription.* events (activated, trial, renewed, payment failed, paused, resumed, cancelled) move subscriptions through Payments::settle_subscription(), where you grant or remove access. Every adapter method is documented at docs.paylexer.com/wordpress/adapters; the same calls also exist as plain paylexer_* functions.

Before going live, untick Test mode under Settings → PayLexer Starter.