Usage Flow
This article walks through the general usage flow of Integration Center, including how to create an integration, invoke an integration function, view runtime status, modify configuration, and delete integrations. For onboarding details of specific integration types (such as WeChat Pay), refer to the corresponding integration guide.
Prerequisites
Before using Integration Center, please confirm:
- A CloudBase environment has been activated
- The current account has both "Integration Management" and "Cloud Function Management" permissions in this environment
- The credentials required by the third-party service to be integrated (merchant ID, API key, certificate, etc.) are ready — refer to the integration details for the exact list
Create an Integration
1. Enter Integration Center
After logging in to the CloudBase console, select Templates & Integrations → Integration Center in the left menu, or directly visit the Integration Center home page.
The page lists all available integration types, grouped by category (Payment, Official Account, AI, Messaging, etc.).
2. Choose an Integration Type
Click the target integration card (e.g. "Mini Program WeChat Pay") to enter the integration detail page. The detail page shows:
- Capability description: which features the integration provides and the scope of third-party APIs covered
- Onboarding doc link: full onboarding steps and sample code
- Create entry: the "Create Integration" button in the upper-right corner
3. Fill in Integration Information
After clicking "Create Integration", fill out the form:
- Integration name: a custom identifier; lowercase letters and hyphens are recommended (e.g.
miniapp-wxpay). This name will be used as the prefix of the generated cloud function name. - Credential fields: vary by integration type (merchant ID, APIv3 key, certificate content, etc.). Each field has a hint pointing to where to obtain the value.
- Optional advanced settings: Some integrations support custom callback paths, debug-mode toggles, etc.
Please double-check before submitting, especially PEM-format certificates and keys — when pasting they easily lose newlines (replaced with spaces) or have missing leading/trailing lines, which causes downstream invocation failures.
4. Wait for Resources to Be Created
After submission, the platform asynchronously completes the following operations (about 1–2 minutes):
| Resource | Description |
|---|---|
| HTTP cloud function | Function name like <integration-name>-<random-string>, with template code preset |
| Environment variables | Credentials, callback URLs, etc. are injected into the function as env vars |
| Callback domain | Like https://<integration-id>.integration-callback.tcloudbase.com |
| Callback routes | Receiving paths for various asynchronous notifications (e.g. /wechatpay/order) |
After creation, the integration detail page shows the actual values of all the resources above — copy them and use them.
Invoke the Integration Function
The integration function is essentially an HTTP cloud function. For Mini Program scenarios, the recommended approach is wx.cloud.callHTTPFunction:
wx.cloud.init({ env: 'your-env-id' })
wx.cloud.callHTTPFunction({
name: 'miniapp-wxpay-rwmx67sc', // actual function name (check after creation)
config: { env: 'your-env-id' },
method: 'POST',
header: { 'Content-Type': 'application/json' },
path: '/wx-pay/wxpay_order', // Express standard route
data: { /* business params */ },
success: (res) => console.log(res.data),
fail: console.error,
})
Mini Program base library version must be ≥ 3.15.2. The platform automatically injects user identity (
x-wx-openid/x-wx-appid); no login or token is required.
For other invocation methods (Web SDK / HTTP API / server-side calls, etc.), see Calling HTTP Cloud Functions.
Handle Callbacks
Asynchronous notifications from third-party services (payment results, message pushes, etc.) first arrive at the callback domain provided by Integration Center. After Integration Center completes signature verification and decryption, it forwards the plaintext to a specific route of the cloud function (e.g. /wechatpay/order).
The business side only needs to handle the plaintext data on the corresponding route in the cloud function code:
// pay-common/services/orderService.js (excerpt)
async function handlerUnifiedTrigger(params) {
// params is already verified and decrypted plaintext
// - params.out_trade_no
// - params.transaction_id
// - params.amount.total
// - params.payer.openid
// 1. Idempotency check: has the order already been processed?
// 2. Amount cross-check: matches the amount at order time
// 3. Atomic state update: PENDING → PAID
// 4. Trigger business side effects: shipping, points, notifications, etc.
return { code: 'SUCCESS' } // must return within 5 seconds
}
Principles to follow when handling callbacks:
- Return quickly: Return success within 5 seconds, otherwise the third party will retry
- Idempotency: The same callback may be delivered repeatedly; multiple executions must produce the same result
- Amount/signature cross-checks: In addition to the verification done by Integration Center, the business side is still recommended to cross-check key fields
- Move time-consuming operations to async: Shipping, push notifications, external API calls, etc. should be dispatched to a queue or scheduled task
View and Manage Integrations
View the Integration List
Integration Center home page → "My Integrations" tab. View all integrations created in the current environment, including:
- Integration name and type
- Creation time, status (Running / Configuration Error / Stopped)
- Associated cloud function name
View Integration Details
Click any integration name to enter the detail page, where you can see:
- Basic info: name, type, creation time
- Associated resources: cloud function, callback domain, callback paths
- Environment variables overview: all env vars currently injected into the function (credential fields are masked)
- Callback logs: recent callback records, including source, status, latency, error code
Modify Integration Configuration
The "Edit" button in the upper-right corner of the detail page lets you modify integration parameters. After saving, the platform will automatically redeploy the cloud function; the new configuration takes effect in about 1–2 minutes.
Common modification scenarios:
- Credential rotation (e.g. APIv3 key updated upon expiry)
- Switching between certificate mode and public-key mode
- Adding optional fields (e.g.
service_app_idfor transfer scenarios)
⚠️ Requests in flight during modification may be affected; off-peak operation is recommended.
View Runtime Logs
The integration function is essentially a cloud function. Logs can be viewed via:
- Console → Cloud Functions → find the corresponding function → "Logs" tab
- CLI:
tcb fn log <function-name> --tail
A dedicated entry for callback logs is available on the integration detail page, including verification status and other integration-layer information.
Modify the Integration Function Code
The cloud function code generated when an integration is created is a template. The business side typically needs to fill in business logic (such as order persistence and callback handling). Ways to modify:
Method 1: Download and Deploy via CLI
# Download function source
tcb fn code <function-name> --download
# Deploy after modification
tcb fn deploy <function-name>
Method 2: Edit Online via Console
Console → Cloud Functions → find the corresponding function → "Function Code" → modify in the online editor and deploy.
⚠️ Do not modify the env vars or configuration files injected by Integration Center — they will be overwritten the next time Integration Center redeploys. Only modify business logic code (e.g.
services/orderService.js).
Delete an Integration
Integrations no longer in use can be removed via the "Delete" button in the upper-right corner of the detail page. On deletion:
- The callback domain and callback routes are released (cannot be recovered; third-party callbacks sent to that domain afterwards will not arrive)
💡 Deleting an integration does not affect the cloud function: the cloud function bound to the integration is an asset the platform generated for you. After the integration is deleted, the cloud function and all of its environment variables are preserved — you can keep customizing it, or go to the Cloud Function console to delete it manually. If you no longer need it, remember to clean it up separately.
⚠️ Before deletion, please confirm:
- The third-party platform's dependency on this integration's callback URL has been revoked (e.g. the merchant platform's payment notification URL has been switched or stopped)
- The business side has stopped calling this integration function
- Necessary runtime logs have been backed up
Next Steps
- Read the onboarding guide for a specific integration (e.g. Mini Program WeChat Pay)
- Create your first integration in the Integration Center console
- Learn about Cloud Function development and debugging
- See the FAQ for common questions on Integration vs. Template, authentication, troubleshooting, and more