API ReferenceOverview

Overview

The PayLexer WordPress developer API: functions, hooks and a browser script for add-on plugins.

This API lets your WordPress plugin take payments through the merchant's existing PayLexer connection. It is defined by the PayLexer plugin (src/developer-functions.php) and is available once PayLexer is active. Your plugin never holds PayLexer keys.

Recommendation: mark orders paid only from the payment_completed webhook, never from the browser callback. See Webhooks.

Conventions

  • Availability: Check function_exists( 'paylexer_api_version' ) if your plugin can run without PayLexer.
  • Errors: Functions return a WP_Error on failure. Adapter methods throw an Exception instead. See Errors.
  • Platform required: Functions taking $platform refuse unless the platform is registered, declared the feature, and PayLexer is connected.
  • Your orders only: Order references and subscription IDs work only on objects your platform created.
  • Amounts are in major units (15.00 is fifteen dollars).
  • Versioning: paylexer_api_version() only gains additive changes within a major version. A breaking change would ship as 2.0.

Function index

GroupFunctions
Platformpaylexer_api_version, paylexer_register_platform, paylexer_register_adapter, paylexer_is_platform_enabled, paylexer_is_connected, paylexer_settings_url
Gatewayspaylexer_get_gateways, paylexer_get_currencies, paylexer_payment_icons
Orderspaylexer_create_checkout, paylexer_get_payment_status, paylexer_get_orders, paylexer_refund, paylexer_render_order_details
Subscriptionspaylexer_create_subscription, paylexer_get_subscription_status, paylexer_cancel_subscription, paylexer_pause_subscription, paylexer_resume_subscription
Webhookspaylexer_init, paylexer_platform_{id}_{event}, WebhookEvent
Browserpaylexer_enqueue_checkout, PayLexer.openCheckout
Platform adaptersPlatformAdapter, CheckoutRequest, SubscriptionRequest

New to the API? Start with the Quickstart, then come back here for details.