Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pay Laravel Package

yansongda/pay

A popular PHP payment library for Laravel and other frameworks, integrating Alipay and WeChat Pay with a clean API. Supports common payment flows, refunds, queries, callbacks/notifications, and flexible configuration for multi-app and sandbox use.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Multi-Payment Gateway Integration: Accelerates roadmap for supporting Alipay, WeChat, Douyin, UnionPay, and Jiangsu Bank without building custom SDKs from scratch. Reduces technical debt by leveraging a PSR-compliant, battle-tested package with 100% API coverage for all providers.
  • Build vs. Buy: Buy—avoids reinventing wheel for payment flows, callback validation, and certificate management. Justifies investment with 5.3K stars, MIT license, and active maintenance (last release: 2026-07-01).
  • Use Cases:
    • E-commerce platforms (multi-tenant support for SaaS models).
    • Marketplaces (UnionPay + Alipay/Douyin for cross-border payments).
    • SaaS subscriptions (WeChat H5/App payments for Chinese users).
    • B2B/B2C hybrid (Jiangsu Bank’s eRong for regional dominance + WeChat for national reach).
  • Tech Stack Alignment: Seamlessly integrates with Laravel/Hyperf/Yii (official extensions available). Supports Swoole for high-concurrency environments.
  • Compliance & Risk Mitigation:
    • Automated certificate rotation (WeChat’s public certs auto-fetched).
    • PSR-14 event system for auditing payment flows (e.g., fraud detection hooks).
    • Multi-tenancy for shared infrastructure (e.g., fintech platforms with per-client gateways).

When to Consider This Package

Adopt When:

  • Targeting Chinese markets: Supports Alipay (60%+ market share), WeChat Pay (mobile-first), and UnionPay (mandatory for offline/online hybrid).
  • Need rapid prototyping: Plugin architecture lets you enable/disable gateways without refactoring. Example: Add Douyin support in <1 hour via Pay::douyin()->mini().
  • High-security requirements:
    • Local signature verification (no API calls to validate callbacks).
    • Certificate management abstracted (e.g., WeChat’s auto-refresh for public certs).
  • Multi-tenant or SaaS: Built-in tenant isolation for shared payment infrastructure.
  • Laravel/Hyperf stack: Official Laravel extension available; minimal boilerplate.

Look Elsewhere If:

  • Non-Chinese focus: Limited to Alipay/WeChat/UnionPay/Douyin/Jiangsu Bank. For global (Stripe/PayPal), consider laravel-cashier or omnipay.
  • Legacy systems: Requires PHP 8.0+ (composer dependency). For older PHP, evaluate v2.x (deprecated).
  • Custom gateway needs: If targeting non-supported providers (e.g., local banks), the plugin system is extensible but may require custom development.
  • Real-time analytics: Lacks built-in payment analytics dashboards (complement with tools like Laravel Nova or ClickHouse).
  • Offline/POS focus: While UnionPay supports card payments, the package is primarily API-driven (not POS SDKs).

How to Pitch It (Stakeholders)

For Executives:

"This package lets us launch in China 10x faster by eliminating custom payment SDK development. With 5.3K stars and MIT licensing, it’s the de facto standard for Alipay/WeChat/UnionPay—used by [insert competitor or benchmark].

  • Risk: Zero. Handles signature validation, certificate rotation, and multi-tenancy out-of-the-box.
  • ROI: 3–6 months saved vs. building from scratch. Example: Our competitor [X] took 12 months to support WeChat H5; we can do it in 2 weeks.
  • Scalability: Supports Swoole for high-volume transactions (critical for marketplaces).
  • Compliance: Meets PCI-DSS (via local validation) and Chinese regulatory requirements (e.g., UnionPay mandates).

Ask: ‘Should we prioritize this for our Q3 China expansion?’"


For Engineering:

"This is the most maintainable way to handle payments in PHP. Here’s why:

  • Unified API: Pay::alipay()->web() vs. Pay::wechat()->mini()consistent patterns across gateways.
  • Zero XML/JSON hell: Abstracts away Alipay’s XML, WeChat’s JSAPI, and UnionPay’s form submissions.
  • Extensible: Add a new gateway (e.g., PayPal) by implementing ProviderInterfaceno core changes.
  • Performance: Swoole support + Guzzle under the hood for async requests.
  • Debugging: PSR-3 logging and PSR-14 events for observability (e.g., hook into PayEvent::PAYMENT_SUCCESS).
  • Certificates: WeChat’s public certs auto-refresh—no more manual downloads.

Trade-offs:

  • Learning curve: If your team hasn’t used Laravel service containers or PSR standards, expect a 1-day ramp-up.
  • Vendor lock-in: Low. The package is modular; you can swap out providers if needed.

Proposal:

  1. Phase 1: Integrate Alipay + WeChat for MVP (2 sprints).
  2. Phase 2: Add UnionPay for offline/online hybrid (1 sprint).
  3. Phase 3: Extend multi-tenancy for SaaS clients.

Blockers to address:

  • Secure storage for private keys (use Laravel’s vault or AWS KMS).
  • Rate limiting for callback retries (add Guzzle middleware).
  • Fallback logic if a gateway fails (e.g., redirect to Alipay if WeChat times out)."
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/opensearch-client
directorytree/opensearch-adapter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata