PHPackages                             tourze/wechat-pay-score-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. tourze/wechat-pay-score-bundle

ActiveSymfony-bundle[Payment Processing](/categories/payments)

tourze/wechat-pay-score-bundle
==============================

微信支付-支付分服务接入套件

0.1.0(4mo ago)00MITPHPCI passing

Since Nov 13Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/wechat-pay-score-bundle)[ Packagist](https://packagist.org/packages/tourze/wechat-pay-score-bundle)[ RSS](/packages/tourze-wechat-pay-score-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (45)Versions (3)Used By (0)

wechat-pay-score-bundle
=======================

[](#wechat-pay-score-bundle)

[![Packagist Version](https://camo.githubusercontent.com/e25e0f56ab1efd4e90840f19062fdd78f8777962bc425e938a6be190aaf22c2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f7765636861742d7061792d73636f72652d62756e646c652e737667)](https://packagist.org/packages/tourze/wechat-pay-score-bundle)[![License](https://camo.githubusercontent.com/0df1a5751a827eb0d9e097b6f57fc9fd265733c031f45001cc2e83cd837d4e58/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f7765636861742d7061792d73636f72652d62756e646c652e737667)](https://github.com/tourze/wechat-pay-score-bundle/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/e76dfbcdcec92c6d26058f98fb5d99ab8aa2744fb864a5abf59d141ec21eb84d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f7765636861742d7061792d73636f72652d62756e646c652e737667)](https://packagist.org/packages/tourze/wechat-pay-score-bundle)[![PHP Version](https://camo.githubusercontent.com/50a94010bed15a2be3a3301fe96f53b9425c71e2fed66dc007bcd9cf02550d6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f7765636861742d7061792d73636f72652d62756e646c652e737667)](https://packagist.org/packages/tourze/wechat-pay-score-bundle)[![Build Status](https://camo.githubusercontent.com/db5ed38c4f6040a0b3f4cfd4a9ca7752654123218a50ef0c517d6b8698497114/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f7765636861742d7061792d73636f72652d62756e646c652f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/tourze/wechat-pay-score-bundle/actions)[![Code Coverage](https://camo.githubusercontent.com/4c6cb6314a649c8ebc3e636296f0249398dfdce435933aeb1d5ad3b91aa45eb9/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7765636861742d7061792d73636f72652d62756e646c65)](https://codecov.io/gh/tourze/wechat-pay-score-bundle)

[English](README.md) | [中文](README.zh-CN.md)

WeChat Pay Score Symfony Bundle for integrating WeChat Pay Score services, supporting create, query, complete, and cancel Pay Score orders.

Table of Contents
-----------------

[](#table-of-contents)

- [Quick Start](#quick-start)
    - [Installation](#installation)
    - [1. Register Bundle](#1-register-bundle)
    - [2. Database Configuration](#2-database-configuration)
    - [3. Basic Usage](#3-basic-usage)
- [Features](#features)
- [Core Components](#core-components)
    - [Entities](#entities)
    - [Enums](#enums)
    - [Services](#services)
    - [Events](#events)
- [Configuration Examples](#configuration-examples)
    - [Entity Relationship Configuration](#entity-relationship-configuration)
    - [Event Listener Configuration](#event-listener-configuration)
- [API Reference](#api-reference)
    - [Order States](#order-states)
    - [Callback Interface](#callback-interface)
- [Requirements](#requirements)
- [Advanced Usage](#advanced-usage)
    - [Custom Event Listeners](#custom-event-listeners)
    - [Order State Management](#order-state-management)
    - [Post-Payment and Discount Configuration](#post-payment-and-discount-configuration)
- [Testing](#testing)
- [Documentation](#documentation)
- [License](#license)

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require tourze/wechat-pay-score-bundle
```

### 1. Register Bundle

[](#1-register-bundle)

Add to `config/bundles.php`:

```
return [
    // ...
    WechatPayScoreBundle\WechatPayScoreBundle::class => ['all' => true],
];
```

### 2. Database Configuration

[](#2-database-configuration)

Run migrations to create necessary tables:

```
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```

### 3. Basic Usage

[](#3-basic-usage)

```
use WechatPayScoreBundle\Entity\ScoreOrder;
use WechatPayScoreBundle\Enum\ScoreOrderState;

// Create Pay Score order
$scoreOrder = new ScoreOrder();
$scoreOrder->setOutTradeNo('20241201001')
    ->setAppId('your_app_id')
    ->setServiceId('your_service_id')
    ->setServiceIntroduction('Service description')
    ->setRiskFundName('Risk fund')
    ->setRiskFundAmount(10000)
    ->setNotifyUrl('https://example.com/notify')
    ->setStartTime('20241201120000')
    ->setState(ScoreOrderState::CREATED);

$entityManager->persist($scoreOrder);
$entityManager->flush();
```

Features
--------

[](#features)

- 🎯 **Pay Score Order Management** - Support create, query, complete, and cancel Pay Score orders
- 📊 **Order Status Tracking** - Complete order status management (Created, Doing, Done, Revoked, Expired)
- 💰 **Payment Handling** - Support post-payment and discount information management
- 🔔 **Callback Processing** - Built-in callback controller for WeChat Pay Score notifications
- 📱 **Mini Program Support** - Support jumping to WeChat Mini Program for Pay Score operations
- 🔒 **Security &amp; Reliability** - Integrated with WeChat Pay official SDK for secure transactions

Core Components
---------------

[](#core-components)

### Entities

[](#entities)

- `ScoreOrder` - Pay Score order entity
- `PostPayment` - Post-payment information entity
- `PostDiscount` - Discount information entity

### Enums

[](#enums)

- `ScoreOrderState` - Order state enumeration

### Services

[](#services)

- `AttributeControllerLoader` - Attribute controller loader
- `CallbackController` - Callback processing controller

### Events

[](#events)

- `ScoreOrderCallbackEvent` - Pay Score order callback event
- `ScoreOrderListener` - Pay Score order event listener

Configuration Examples
----------------------

[](#configuration-examples)

### Entity Relationship Configuration

[](#entity-relationship-configuration)

```
// Add Pay Score order relationship in your user entity
class User
{
    #[ORM\OneToMany(mappedBy: 'user', targetEntity: ScoreOrder::class)]
    private Collection $scoreOrders;
}
```

### Event Listener Configuration

[](#event-listener-configuration)

```
// Listen to Pay Score order status changes
class ScoreOrderSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ScoreOrderCallbackEvent::class => 'onScoreOrderCallback',
        ];
    }

    public function onScoreOrderCallback(ScoreOrderCallbackEvent $event): void
    {
        $scoreOrder = $event->getScoreOrder();
        // Handle order status changes
    }
}
```

API Reference
-------------

[](#api-reference)

### Order States

[](#order-states)

StateDescription`CREATED`Created`DOING`In Progress`DONE`Completed`REVOKED`Cancelled`EXPIRED`Expired### Callback Interface

[](#callback-interface)

The system automatically registers callback route: `/wechat-pay-score/callback`

Requirements
------------

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+
- WeChat Pay Official SDK

Advanced Usage
--------------

[](#advanced-usage)

### Custom Event Listeners

[](#custom-event-listeners)

```
use WechatPayScoreBundle\Event\ScoreOrderCallbackEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class CustomScoreOrderListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ScoreOrderCallbackEvent::class => 'onScoreOrderCallback',
        ];
    }

    public function onScoreOrderCallback(ScoreOrderCallbackEvent $event): void
    {
        $scoreOrder = $event->getScoreOrder();
        $callbackData = $event->getCallbackData();

        // Custom business logic
        switch ($scoreOrder->getState()) {
            case ScoreOrderState::DONE:
                // Handle completed order
                break;
            case ScoreOrderState::REVOKED:
                // Handle cancelled order
                break;
        }
    }
}
```

### Order State Management

[](#order-state-management)

```
use WechatPayScoreBundle\Entity\ScoreOrder;
use WechatPayScoreBundle\Enum\ScoreOrderState;

// Complete an order
$scoreOrder->setState(ScoreOrderState::DONE);
$scoreOrder->setEndTime(date('YmdHis'));
$scoreOrder->setTotalAmount(10000);
$entityManager->flush();

// Cancel an order
$scoreOrder->setCancelReason('User requested cancellation');
$entityManager->remove($scoreOrder);
$entityManager->flush();
```

### Post-Payment and Discount Configuration

[](#post-payment-and-discount-configuration)

```
use WechatPayScoreBundle\Entity\PostPayment;
use WechatPayScoreBundle\Entity\PostDiscount;

// Add post-payment information
$postPayment = new PostPayment();
$postPayment->setName('Service Fee')
    ->setAmount(5000)
    ->setDescription('Basic service fee')
    ->setCount(1);

$scoreOrder->addPostPayment($postPayment);

// Add discount information
$postDiscount = new PostDiscount();
$postDiscount->setName('New User Discount')
    ->setAmount(1000)
    ->setDescription('First-time user discount')
    ->setCount(1);

$scoreOrder->addPostDiscount($postDiscount);
```

Testing
-------

[](#testing)

```
# Run tests
./vendor/bin/phpunit packages/wechat-pay-score-bundle/tests

# Run code analysis
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/wechat-pay-score-bundle
```

Documentation
-------------

[](#documentation)

- \[WeChat Pay Score API Documentation\] ([https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6\_1\_1.shtml](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_1.shtml))
- \[WeChat Pay Score Business Introduction\] ([https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2\_8.shtml](https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_8.shtml))
- \[Symfony Bundle Development Guide\] ()

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance74

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Total

2

Last Release

141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-wechat-pay-score-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-wechat-pay-score-bundle/health.svg)](https://phpackages.com/packages/tourze-wechat-pay-score-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
