Woo payments

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Woo payments is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. 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.

How to use this skill

Skill file

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:

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

Implementation Methods

Required Methods

Optional Methods

process_payment Return Format

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:

Supports Array

$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

Webhook/IPN Handling

Registering Webhook Endpoints

Use WC_API to register callback URLs:

Order Status Management

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

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.