lokielse/omnipay-alipay
Omnipay Alipay driver for PHP: integrates Alipay payment gateways through the Omnipay library. Supports Express, Web, WAP, App, and mobile payments, plus refunds, order queries, and close operations. Works with Laravel and other PHP frameworks via Omnipay.
Architecture fit
The package is a driver for the League Omnipay payment abstraction rather than a Laravel package per se. It exposes one gateway class per Alipay product line (web/express redirect, WAP, native App, and Alipay Open Platform "AOP" style calls) behind a uniform GatewayInterface: purchase, completePurchase (async notify + return), refund, query, close. That is a good architectural fit if the product already standardizes on Omnipay, because Alipay becomes one swappable driver among several and controller code stays gateway-agnostic. If we are not already on Omnipay, we would be adopting a second abstraction layer to integrate a single gateway — in that case the official Alipay Open Platform SDK (or a PSP aggregator) is a lighter, better-supported path.
Integration feasibility
Mechanically straightforward: pure PHP, Composer-installable, MIT-licensed, no native extensions, no daemon. The redirect + server-to-server notify model keeps card data out of our systems and keeps PCI scope minimal. The notify/return pattern maps cleanly onto Laravel routes, middleware, and queued jobs. The real feasibility question is not "can we install it" but "does it speak the API surface our merchant account is provisioned for" — legacy MAPI/Express (create_direct_pay_by_user, MD5/RSA1) is closed to new merchants, so we must confirm the AOP gateway class is usable with RSA2 and app-certificate mode, not just key mode. Secondary blockers to verify in a spike: Composer constraints against Laravel 10/11 (PHP 8.1+, Guzzle 7), and whether omnipay/common resolves to a PHP 8-compatible version alongside this package's pins.
Technical risk — HIGH
completePurchase decides whether money actually arrived. A defect here is a direct fraud/free-goods vector. This code must be read, not trusted.Key questions
Stack fit
Treat Omnipay as an internal port. Do not wire the package into controllers. Define a PaymentGateway interface in the domain layer, implement AlipayOmnipayGateway against Omnipay\Common\GatewayInterface, and bind it in a PaymentServiceProvider. Configuration (app_id, private key, Alipay public key/cert, notify_url, return_url, sandbox flag) belongs in config/services.php + environment secrets, never in code. This keeps the blast radius of abandoning the package to one adapter class.
Migration path
Compatibility
Expect two concrete conflicts and resolve them at fork time: (a) PHP 8.1/8.2 deprecation notices and missing return types; (b) Guzzle/php-http pins colliding with Laravel 9+ (Guzzle 7). Forking and widening the constraint is usually a one-line Composer change plus a CI matrix run. Add PHPStan/Larastan at a modest level and a PHPUnit job that exercises signing/verification with fixed fixtures — those are the pieces that break silently.
Sequencing
out_trade_no + trade_no, enqueue and ack fast), query-based reconciliation job as the safety net for lost notifies.Maintenance Assume full ownership. Budget roughly 1–2 engineer-days per month for the first two quarters (dependency bumps, Alipay changelog review, sandbox regression), tapering to reactive afterwards. The recurring obligations are: tracking Alipay Open Platform deprecations, rotating keys/certificates on schedule (a silent expiry breaks checkout and refunds simultaneously), and keeping the fork's CI green against new PHP/Laravel releases.
Support Upstream support is effectively zero — stale issues, no releases in five years. Alipay's own support is Chinese-language, business-hours in CST, and routed through a merchant account manager; there is no developer-tier ticket queue for a self-hosted integration. This argues for a named internal owner and a written runbook rather than "ask the vendor."
Scaling The collection path is stateless redirect + async notify, so it scales horizontally with the app tier at no marginal cost. The real constraints are: (a) notify handling must be fast and idempotent — ack in well under a second and push fulfillment to a queue, because Alipay retries on non-2xx with a widening schedule and will eventually give up; (b) egress latency/reliability to Alipay endpoints from US/EU regions is materially worse than from Asia — consider a regional egress or a cross-border endpoint; (c) refund throughput is bounded by Alipay-side rate limits, so batch and queue.
Failure modes to instrument
query reconciliation over in-flight orders older than N minutes.(gateway, trade_no) and idempotent handlers.Ramp-up Two to three weeks of effective ramp for an engineer unfamiliar with Omnipay and Alipay: the codebase is small, but the failure modes are learned only by running the sandbox loop repeatedly. The Chinese-language docs and the absence of a working upstream example set add roughly 30–40% to the spike duration. Front-load the spike specifically to de-risk the RSA2/cert path — that is where this package is most likely to cost the most time, and where a "no" answer most cheaply redirects the plan to an aggregator.
How can I help you explore Laravel packages today?