woo-payments

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

17 stars

Best use case

woo-payments is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

Teams using woo-payments should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/woo-payments/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/woocommerce-commerce/.agent/skills/woo-payments/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/woo-payments/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How woo-payments Compares

Feature / Agentwoo-paymentsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# WooCommerce Payment Gateway Development

## Before writing code

**Fetch live docs**:
1. Web-search `site:developer.woocommerce.com payment gateway api` for payment gateway guide
2. Web-search `woocommerce payment gateway tutorial` for implementation patterns
3. Fetch `https://woocommerce.github.io/code-reference/classes/WC-Payment-Gateway.html` for class reference

## Gateway Architecture

### Base Class: WC_Payment_Gateway

All gateways extend `WC_Payment_Gateway` (which extends `WC_Settings_API`):

| Property | Description |
|----------|-------------|
| `$id` | Unique gateway identifier |
| `$method_title` | Admin-facing title |
| `$method_description` | Admin-facing description |
| `$title` | Customer-facing title |
| `$description` | Customer-facing description |
| `$icon` | URL to gateway icon |
| `$has_fields` | Whether gateway has payment fields on checkout |
| `$supports` | Array of supported features |

### Registration

Filter `woocommerce_payment_gateways`:
```php
add_filter( 'woocommerce_payment_gateways', function( $gateways ) {
    $gateways[] = 'My_Payment_Gateway';
    return $gateways;
});
```

## Implementation Methods

### Required Methods

- **`__construct()`** — set `$id`, `$method_title`, `$supports`, call `init_form_fields()`, `init_settings()`, load saved settings, register `process_admin_options` hook
- **`init_form_fields()`** — define admin settings (API keys, sandbox mode, etc.)
- **`process_payment( $order_id )`** — core payment logic, returns `result` + `redirect` array

### Optional Methods

- `payment_fields()` — render custom payment form HTML on checkout
- `validate_fields()` — validate payment form input
- `process_refund( $order_id, $amount, $reason )` — handle refunds
- `get_icon()` — customize the gateway icon display

### process_payment Return Format

```php
return [
    'result'   => 'success', // or 'failure'
    'redirect' => $order->get_checkout_order_received_url(),
];
```

## Integration Models

### Direct Integration

Gateway processes payment inline:
1. Collect card data via `payment_fields()` (or tokenized via JS SDK)
2. Call payment processor API in `process_payment()`
3. Mark order: `$order->payment_complete( $transaction_id )`
4. Return success with redirect to thank-you page

### Redirect Integration

Customer redirected to external payment page:
1. `process_payment()` returns redirect URL to processor
2. Processor handles payment and redirects back
3. Handle return via a webhook or callback URL
4. Process the response and update order status

### Hosted/Iframe Integration

Payment form loaded in iframe on checkout page:
- Set `$has_fields = true`
- Render iframe/JS SDK in `payment_fields()`
- Handle tokenization callback

## Supports Array

```php
$this->supports = [
    'products',           // Basic payment support
    'refunds',            // process_refund()
    'tokenization',       // Saved payment methods
    'subscriptions',      // WooCommerce Subscriptions
    'subscription_cancellation',
    'subscription_reactivation',
    'subscription_suspension',
    'subscription_amount_changes',
    'subscription_date_changes',
];
```

## Tokenization (Saved Payment Methods)

### WC_Payment_Token System

- Extend `WC_Payment_Token_CC` (credit cards) or `WC_Payment_Token` (generic)
- `$this->supports[] = 'tokenization'`
- Override `tokenization_script()` to enqueue JS
- Save tokens via `WC_Payment_Tokens::set_users_default()`
- Customer manages saved methods in My Account > Payment Methods

## Webhook/IPN Handling

### Registering Webhook Endpoints

Use `WC_API` to register callback URLs:
- `add_action( 'woocommerce_api_{$id}', [ $this, 'handle_webhook' ] )`
- Callback URL: `home_url( '/wc-api/{$id}/' )`
- Verify signatures, process payment notifications, update order status

## Order Status Management

- `$order->update_status( 'processing', 'Payment received' )` — status + note
- `$order->payment_complete( $transaction_id )` — marks paid, triggers emails
- `$order->update_status( 'failed', 'Payment failed' )` — mark failed
- `$order->add_order_note( 'Note text' )` — add admin/customer note

## Block Checkout Support

For block-based checkout, gateways need a JS integration:
1. Register a payment method via `@woocommerce/blocks-registry` → `registerPaymentMethod()`
2. Provide React components for: `content`, `edit`, `label`
3. Define `canMakePayment` callback
4. Handle payment data submission via `onPaymentSetup` event

## Best Practices

- **Never** log or store raw credit card data
- Always use sandbox/test mode for development
- Verify webhook signatures to prevent spoofing
- Handle all error states gracefully with clear customer messages
- Support refunds if the processor allows them
- Declare `cart_checkout_blocks` compatibility and provide block checkout integration
- Use `$order->payment_complete()` — it handles status, stock reduction, and email triggers
- Store transaction IDs via `$order->set_transaction_id()`

Fetch the WooCommerce payment gateway documentation and code reference for exact method signatures, supported features, and block checkout integration patterns before implementing.

Related Skills

spree-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Integrate payment gateways with Spree — PaymentMethod model, the v5.4+ PaymentSession provider-agnostic checkout flow, Stripe via `spree_stripe` (Apple/Google Pay, Link, Connect for marketplaces), Adyen via `spree_adyen`, PayPal via `spree_paypal_checkout`, StoreCredit / GiftCard as payment methods, refunds, payment state machine, and authoring a custom gateway. Use when wiring a payment integration, handling webhooks from a gateway, or debugging payment-state issues.

sf-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Salesforce Commerce payments — Salesforce Payments (supports multiple processors including Stripe and Adyen), B2C payment adapters (JavaScript cartridge-based), B2B payment adapters (Apex-based), PCI compliance via tokenization, 3D Secure/SCA support, and payment method management. Use when implementing payment processing.

saleor-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Saleor payment processing — transaction-based payment flow, payment Apps, sync webhook events, Stripe/Adyen patterns, and refunds. Use when building payment integrations.

medusa-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Medusa v2 payment processing — payment module, provider abstraction, payment sessions, authorization/capture/refund lifecycle, and Stripe/PayPal integration. Use when adding payment providers.

bc-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Integrate BigCommerce payments — Payment Processing API, stored payment instruments, payment methods, server-side payment processing for headless, and PCI considerations. Use when building custom payment flows or processing payments programmatically.

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-plugin-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.