← All projects

Woo Payment Gateway

Custom WooCommerce payment gateway built for the Dominican Republic market.

Role
Sole engineer — architecture, implementation, and security review
Stack
  • PHP
  • WooCommerce
  • JavaScript
  • Payment APIs
  • WordPress Hooks
Links
GitHub

Walkthrough: how a payment becomes a paid order

Scroll through the payment flow. The diagram stays pinned and lights up the part each step explains.

Checkout

Collect and validate

The gateway extends WC_Payment_Gateway and hooks into checkout. Custom fields are validated in JavaScript and always re-validated on the server, never trusting the client.

Processor

A processor WooCommerce doesn't support

A processor common in the Dominican Republic with its own transaction lifecycle, validation rules and webhook-based confirmation, and no existing WooCommerce plugin.

The trap

Never trust the redirect

Marking an order paid because the customer reached the thank-you page would be forgeable. The redirect response alone is never trusted.

Webhook

Server-to-server confirmation

A webhook endpoint verifies the processor's signature before touching any order, and handles retried callbacks idempotently so nothing is processed twice.

Order status

Paid, pending or declined

Order status changes only from the verified webhook. Failed and pending stay distinct states, so support can tell declined from awaiting confirmation.

Overview

A client needed to accept payments through a processor common in the Dominican Republic market that had no existing WooCommerce integration — the default gateways didn’t support it, and no reliable plugin existed.

The Challenge

WooCommerce’s checkout flow assumes a fairly standard request/response payment cycle. This processor’s API had its own transaction lifecycle, validation rules, and webhook-based confirmation, none of which mapped cleanly onto WooCommerce’s built-in gateway assumptions.

My Role

I built the gateway from scratch as a custom WooCommerce payment gateway class, including checkout UI, server-side validation, and transaction handling.

Architecture

The gateway extends WC_Payment_Gateway, hooking into WooCommerce’s checkout process to collect and validate payment details before the order is placed. Transaction confirmation is handled asynchronously via webhook, with order status updated only after the processor confirms the transaction server-side — never based on the client-side response alone.

Technical Implementation

Engineering Challenges

The riskiest part of any payment integration is trusting the wrong signal. Early in development, relying on the checkout page’s redirect response to mark an order “paid” would have been forgeable — a customer could reach the confirmation page without the processor ever confirming payment.

Solution

Order status changes are driven exclusively by the server-to-server webhook, validated against the processor’s signature, decoupling “the customer reached the thank-you page” from “the payment is confirmed.”

Performance / Security / Scalability

Webhook signature verification, idempotent webhook handling to avoid double-processing retried callbacks, and no sensitive payment data stored in WordPress beyond what’s required for order records.

Results

The store went live with a payment method required by its market. Order status is based on verified server-to-server confirmation, while pending and failed transactions remain distinguishable for support staff.

Key Takeaways

The project demonstrates transaction integrity, idempotent webhook handling, server-side validation, and practical use of WooCommerce’s extension points.

Looking for a Senior WordPress / PHP Engineer?

I’m available for remote opportunities with international teams.