GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implement WeChat Pay V3 subscription billing functionality (预约扣费功能/连续包月功能) by Copilot · Pull Request #3688 · binarywang/WxJava

Conversation

Copilot AI commented Aug 31, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR implements the WeChat Pay V3 subscription billing functionality (预约扣费功能/连续包月功能) as requested by the community. The subscription billing feature enables merchants to automatically charge users on a recurring basis for services like monthly subscriptions, with proper user authorization.

What's Added

Service Interface

  • SubscriptionBillingService - Main service interface providing subscription billing operations

Bean Classes

Complete request/response model classes following WeChat Pay V3 API specification:

  • SubscriptionScheduleRequest/Result - Schedule future billing
  • SubscriptionQueryResult - Query subscription status
  • SubscriptionCancelRequest/Result - Cancel subscriptions
  • SubscriptionInstantBillingRequest/Result - Execute immediate billing
  • SubscriptionTransactionQueryRequest/Result - Query billing history
  • SubscriptionAmount - Amount and currency information
  • BillingPlan - Billing plan configuration (monthly/weekly/daily/yearly)

Service Implementation

  • SubscriptionBillingServiceImpl - Complete implementation following existing V3 API patterns
  • Integrated into WxPayService interface and BaseWxPayServiceImpl
  • Proper error handling and exception management

Features Supported

  1. Schedule Subscription Billing - Create advance billing schedules for recurring payments
  2. Query Subscription Status - Check subscription details and current status
  3. Cancel Subscriptions - Cancel existing subscription schedules
  4. Instant Billing - Execute immediate charges (useful for makeup payments)
  5. Query Transaction Records - Retrieve billing history with pagination

Usage Example

// Get the subscription billing service
SubscriptionBillingService service = wxPayService.getSubscriptionBillingService();

// Create a monthly subscription
SubscriptionScheduleRequest request = new SubscriptionScheduleRequest();
request.setOutTradeNo("monthly_vip_" + System.currentTimeMillis());
request.setOpenid("user_openid");
request.setDescription("VIP会员 - 连续包月");
request.setScheduleTime("2024-09-01T10:00:00+08:00");

// Set amount
SubscriptionAmount amount = new SubscriptionAmount();
amount.setTotal(3000); // 30 RMB in cents
amount.setCurrency("CNY");
request.setAmount(amount);

// Configure monthly billing plan
BillingPlan plan = new BillingPlan();
plan.setPlanType("MONTHLY");
plan.setPeriod(1);
plan.setTotalCount(12); // 12 months
request.setBillingPlan(plan);

// Execute the subscription
SubscriptionScheduleResult result = service.scheduleSubscription(request);

Implementation Details

The implementation follows WeChat Pay V3 API documentation: https://pay.weixin.qq.com/doc/v3/merchant/4012161105

  • API Endpoints: All 5 core subscription billing endpoints are supported
  • Authentication: Uses existing V3 signature and certificate handling
  • Error Handling: Leverages existing WxPayException framework
  • Code Style: Passes all checkstyle validations and follows project patterns
  • Testing: Includes basic test structure (disabled by default due to credential requirements)
  • Documentation: Comprehensive usage guide with examples provided

Code Quality

✅ Builds successfully with existing codebase
✅ Passes all checkstyle validations
✅ Follows established architectural patterns
✅ Comprehensive JavaDoc documentation
✅ Proper exception handling

This implementation provides production-ready support for WeChat's subscription billing capabilities while maintaining full compatibility with the existing WxJava architecture.

Fixes #3593.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
84358d8
Copilot AI assigned Copilot and binarywang Aug 31, 2025
Copilot started work on behalf of binarywang August 31, 2025 14:50
View session
Copilot AI and others added 2 commits August 31, 2025 15:03
@binarywang
Implement WeChat Pay V3 subscription billing functionality (预约扣费功能)
dcbc337
Co-authored-by: binarywang <[email protected]>
@binarywang
Add comprehensive usage documentation for subscription billing functi…
9e6ad5c
…onality

Co-authored-by: binarywang <[email protected]>
Copilot AI changed the title [WIP] 功能询问-预约扣费功能 Implement WeChat Pay V3 subscription billing functionality (预约扣费功能/连续包月功能) Aug 31, 2025
Copilot finished work on behalf of binarywang August 31, 2025 15:05
Copilot AI requested a review from binarywang August 31, 2025 15:05
@binarywang binarywang added this to the 4.7.9 milestone Sep 24, 2025
@binarywang
Merge branch 'develop' into copilot/fix-3593
f45b3d4
@binarywang
binarywang marked this pull request as ready for review November 15, 2025 09:11
@binarywang
binarywang merged commit 092e992 into develop Nov 15, 2025
1 check was pending

Uh oh!

There was an error while loading. Please reload this page.

@binarywang
binarywang deleted the copilot/fix-3593 branch November 15, 2025 09:16
Copilot AI added a commit that referenced this pull request Dec 21, 2025
🆕 #3688 【微信支付】 实现预约扣费服务的相关接口
1825b9b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@binarywang binarywang Awaiting requested review from binarywang

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@binarywang binarywang

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

4.7.9

Development

Successfully merging this pull request may close these issues.

功能询问-预约扣费功能

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@binarywang
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.