WordPress Payment Integration

1. Overview

The WordPress payment integration enables event registration payments through WooCommerce on WordPress sites. This solution bridges the Event Management System’s admin-service with WordPress/WooCommerce, providing a complete payment workflow for events and memberships.

The integration is implemented as a WordPress plugin (event-payment-plugin-woocommerce) that:

  • Receives order creation requests from the registration portal

  • Creates WooCommerce orders for payment processing

  • Synchronises payment status back to the admin-service

  • Manages user accounts for returning customers

2. Integration Architecture

wordpress-payment-architecture

3. Order Lifecycle

WooCommerce order statuses are mapped to admin-service statuses:

WooCommerce Status Admin-Service Status Description

pending

PENDING

Order created, awaiting payment

processing

PAID

Payment received, processing

completed

PAID

Order fulfilled

on-hold

PENDING

Awaiting action (e.g., EFT confirmation)

cancelled

CANCELLED

Order cancelled by user or admin

refunded

REFUNDED

Payment refunded

failed

CANCELLED

Payment failed

4. Data Flow

4.1. Inbound: Order Creation

The registration portal sends a JSON payload to the WordPress REST endpoint:

POST /wp-json/payment-api/v1/order/event/create/

Payload structure:

  • API key for authentication

  • Admin portal order ID

  • Event details (ID, name, date)

  • Participants with product mappings

  • Total and discount amounts

4.2. Outbound: Status Synchronisation

Status updates are sent to the admin-service via the generated API client:

PATCH /api/orders/participant/{orderId}

Synchronisation triggers:

  • woocommerce_thankyou - Initial payment processing

  • woocommerce_order_status_{status} - Any status change

5. Security

5.1. API Authentication

  • Inbound requests: Custom API key validated in JSON payload

  • Outbound requests: X-API-KEY header to admin-service

  • Both keys configured in WordPress options

5.2. Data Validation

  • Strict validation of incoming payloads

  • Product ID verification against WooCommerce catalogue

  • Numeric ID type checking

  • Sanitisation of all input data

5.3. User Management

  • Automatic WordPress user creation for new customers

  • Email-based user linking for returning customers

  • Auto-login after successful payment (if email matches)

6. Configuration

Required WordPress options:

Option Description

epa_admin_api_url

Admin-service base URL

epa_admin_api_key

API key for admin-service

epa_callback_api_key

API key for inbound validation

epa_default_prod_id

Fallback WooCommerce product ID

epa_entry_portal_url

Registration portal URL

epa_redirect_url

Post-payment redirect URL

epa_strict_data_checks

Enable strict validation mode

epa_enable_logging

Enable debug logging