Fluentcart payment gateways

From Lonsdale201/wp-agent-skills · View interactive version

Fluentcart payment gateways is an AI agent skill from the GitHub repository Lonsdale201/wp-agent-skills. Builds and audits third-party FluentCart payment gateways using AbstractPaymentGateway, BaseGatewaySettings, PaymentInstance, GatewayManager, frontend fluent_cart_load_payments_* events, transaction reconciliation, refunds, signed webhooks, and optional subscription capabilities. Use when registerin

How to use this skill

Skill file

FluentCart payment gateways

Implement a gateway as a provider adapter around FluentCart's order,

transaction, and subscription state machine. A successful browser callback is

not proof of settlement.

Read gateway-contract.md before creating the

PHP class, checkout JavaScript, webhook, or subscription branch.

Implement the required contract

Extend AbstractPaymentGateway and supply BaseGatewaySettings. Implement:

GatewayManager 1.6.0 requires meta keys brand_color, description, icon, logo,

route, status, and title. Also provide slug, upcoming, label/admin_title where

the corresponding UI path reads them. Keep route, slug, registration key,

frontend event suffix, stored option key, and webhook method consistent.

Attach the listener by fluentcart_loaded at the latest, then register during

fluent_cart/register_payment_methods. In 1.6.0 the registration action runs in

an earlier init callback than fluent_cart/init; adding this listener from

fluent_cart/init is too late.

~~~php

add_action('fluent_cart/register_payment_methods', static function (): void {

fluent_cart_api()->registerCustomPaymentMethod(

'acme_pay',

new \Acme\FluentCart\AcmeGateway()

);

});

~~~

registerCustomPaymentMethod requires an AbstractPaymentGateway instance.

GatewayManager invokes boot() when present and injects StoreSettings.

Process the initial payment

Use the supplied PaymentInstance. Resolve/create provider objects with a stable

idempotency key derived from the FluentCart transaction/payment attempt and

mode. Return the response shape used by the active checkout client; 1.6.0

built-ins use status plus redirect_to or redirect_url depending on path, so test

the concrete checkout script instead of copying the generic docs example.

Never:

Reconcile through the webhook

handleIPN() is publicly reachable. Verify the provider signature against the

raw request body before parsing business fields. Then verify event type, mode,

account, currency, amount, provider object ownership, FluentCart references,

and previous processing state.

Use a durable provider event/object idempotency record. Update/create the

transaction, then call the normal status synchronization path. Return a quick

2xx only after the local claim is durable; queue slow secondary work.

Do not construct a listener URL from memory. In 1.6.0 the source contains two

forms: PaymentHelper::listenerUrl() emits fct_payment_listener=1, while the

source-verified central WebRoutes handler and built-in Stripe/PayPal constants

use fluent-cart=fct_payment_listener_ipn. Confirm with an actual request that

the URL reaches this gateway's handleIPN() and re-audit this discrepancy after

upgrades.

Integrate checkout JavaScript

Add optional capabilities deliberately

charging is implemented.

provider supports it.

system charges, preserving the true/processing/WP_Error contract.

branch by respecting shouldChargeSubscriptionAsOneTime().

Test matrix

Test live/test credentials, success, decline, cancel, retry, duplicate checkout,

browser-confirmation/webhook race, duplicate/out-of-order webhook, partial/full

refund, zero total, free trial setup, subscription renewal, signature failure,

wrong amount/currency/account, and unavailable provider API.

Cross-references

References

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.