a collection of subscription and paid tools
Author: alipay
Version: 0.0.1
Type: tool
AI agent developers can seamlessly integrate subscription payment services through the Alipay AI Subscription Payment Plugin. This plugin enables developers to implement flexible pricing models (per-usage or time-based) within their AI agents. Currently, it provides subscription initialization, subscription status querying, and subscription-based consumption tracking capabilities.
This plugin encompasses three essential tools:
To configure API Key authorization, the following parameters are required:
| Configuration Key | Description | Required | Example Value |
|---|---|---|---|
| Alipay Open Platform App ID | APPID obtained from the Alipay Open Platform | Required | 2021xxxxxxxx8009 |
| Application Private Key | Private key configured in the Alipay Open Platform | Required | MIIEvw.....kO71sA== |
| Alipay Public Key | Alipay server public key from the open platform | Required | MIIBIjA......AQAB |
| Third-party Service Provider Authorization Token | Service provider authorization token (required only for third-party service provider mode) | Optional | 202504BBdd...X49 |
How to Obtain: For detailed instructions on obtaining Alipay Open Platform App ID, Application Private Key, and Alipay Public Key, please refer to: Integration Prerequisites
Creates an Alipay subscription order and returns a payment URL. Users can click the link to be redirected to Alipay to complete the subscription payment.
Parameter Specifications:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| agent_id | string | No | AI Agent ID |
| agent_name | string | Yes | AI Agent Name |
| plan_id | string | Yes | Subscription Plan ID |
| uuid | string | Yes | Unique User Identifier |
Queries the status of Alipay subscription agreements to verify whether a user's subscription remains valid.
Parameter Specifications:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| plan_id | string | Yes | Subscription Plan ID |
| uuid | string | Yes | Unique User Identifier |
Executes Alipay subscription consumption with usage-based billing operations.
Parameter Specifications:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| out_request_no | string | Yes | External request number for unique request identification |
| plan_id | string | Yes | Subscription Plan ID |
| use_times | number | Yes | Number of usage deductions |
| uuid | string | Yes | Unique User Identifier |
Using a simple conversational AI agent as an example, we demonstrate an AI assistant integrated with subscription capabilities. This assistant provides subscription services to users, including subscription creation, status querying, and usage-based billing.


Add the Alipay subscription plugin to your AI agent in the Dify platform.
In a workflow scenario, when users inquire about subscription status, invoke the "Query Alipay Subscription Status" tool:

Response:

When users request subscription services, invoke the "Initialize Alipay Subscription Link" tool to generate a payment URL. After generating the subscription link, for desktop users, convert the URL to a QR code to guide users through scanning and subscribing. For mobile users, direct clicking will initiate the subscription.
Response:

When users utilize services, invoke the "Alipay Subscription Usage Service" tool for usage-based billing:
Response:

| Error Code | Error Description | Root Cause | Solution |
|---|---|---|---|
| isv.invalid-cloud-app-permission | Invalid open scenario status | Payment MCP Server feature is not enabled | Log in to the Open Platform Console, navigate to your application details page, locate Restricted Keys in development settings, click View, and enable Payment MCP Server in the restricted key details page. |
| isv.missing-signature-key | Missing signature configuration | Interface signature method for restricted keys is not configured | Log in to the Open Platform Console, navigate to your application details page, locate Restricted Keys in development settings, click View, and complete the Interface Signature Method configuration in the restricted key details page. |
| isv.invalid-signature | Signature verification exception | The private key configured in the tool does not match the public key configured for interface signature method in the Alipay Open Platform restricted keys | 1. Use new keys: After generating new keys, log in to the Open Platform Console, navigate to your application details page, locate Restricted Keys in development settings, click View, and reconfigure the Interface Signature Method in the restricted key details page. 2. Use matching keys, refer to Key Matching to find compatible keys. |
| isv.invalid-open-scene-api-permission | Invalid open scenario API permissions | Required tools have not been selected | Log in to the Open Platform Console, navigate to your application details page, locate Restricted Keys in development settings, click View, and select the tools you need to invoke in the restricted key details page. |
We look forward to exploring the limitless possibilities of AI subscription payments with developers, jointly creating smarter and more convenient subscription payment experiences. If you encounter any issues during usage or have collaboration inquiries, please join the Alipay AI Service Partnership Group by scanning the DingTalk QR code below. We are always ready to listen to your suggestions and requirements.
