/v2/miniprogram/serviceProxy
POST /v2/miniprogram/serviceProxy
The serviceProxy
API plays the role as a proxy to transfer services from the wallet server to an AIMPDP (Alipay International MiniProgram Development Platform) Region node to process. This helps to reduce costs for wallets to join the AIMPDP Region.
Sample
Regarding the serviceProxy
API, there are two flows.
Flow one

Steps:
Step 1, 2: An app send a service request to Alipay+ SDK for service assembly.
Step 3, 4: Alipay+ SDK sends SPI to the wallet client, which is directly forwared to the wallet server.
Step 5, 6: The wallet server verifies the login status, and makes up for the Customer ID. Then the wallet server transfer the service request to the AIMPDP Region
Step 7 - 11: the AIMPDP Region handles the service and returns the response back to the app.
Flow two

Steps:
Step 1: A merchant server send a service request (with an access token) to a wallet server.
Step 2, 3: The wallet server replaces the access token with userId
and then transfers the service request to the AIMPDP Region.
Step 4 - 6: The AIMPDP Region handles the service and returns the response back to the app.
Request sample
{
"customerId": "2323423423432xxx",
"sourceType": "APP_CLIENT",
"proxyRequestHeader": "{\"Content-Type\":\"application/x-www-form-urlencoded\",\"appId\":\"eWALLET_name\",\"workspaceId\":\"default\",\"Cookie\":\"ALIPAYINTLJSESSIONID=Bzg1WFN18Z+wlZJKTVVRgl5gE7KSNhiVmomobilewalletxxx\"}",
"proxyRequestData": "operationType=ac.mobilepayment.instorepayment.cpm.encode&requestData=%5B%7B%22codeType%22%3A%22AC19%22%2C%22batchCount%22%3A3%2C%22generateInterval%22%3A30%2C%22mobileInStorePaymentInitInfo%22%3A%7B%22tid%22%3A%22XiraEsnY6M0DAGj81GgWvurj_C001F0A9141CEB3D%22%7D%2C%22extParams%22%3A%7B%7D%2C%22evnInfo%22%3A%7B%22terminalType%22%3A%22APP%22%2C%22sourcePlatform%22%3A%22MAIN_APP%22%2C%22osType%22%3A%22ios%22%2C%22osVersion%22%3A%2213.3%22%2C%22sdkVersion%22%3A%221.1.0%22%2C%22appVersion%22%3A%221.9.0%22%7D%7Dxxx"
}
Response sample
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMesssage": "success"
},
"proxyResponseHeader": "{\"Mgw-TraceId\":\"0ba7d3c0158192116765747128009xxx\",\"Result-Status\":\"1000\",\"Server-Time\":\"1581921168086\",\"Ac-UserId\":\"2088213892193712xxx\"}",
"proxyResponseData": "{\"currentServerTime\":\"1581921168000\",\"errorActions\":{},\"extendInfo\":{},\"mobileInStorePaymentEncodeResultInfos\":[{\"paymentCode\":\"2898879049608687904\",\"startServerTime\":\"1581921168000\"},{\"paymentCode\":\"2890734921560673492\",\"startServerTime\":\"1581921198000\"},{\"paymentCode\":\"2893940194773694019\",\"startServerTime\":\"1581921228000\"}],\"success\":true,\"traceId\":\"0ba7d3c0158192116765747128009xxx\"}"
}
Structure
Request
Property | Data type | Required | Description | Example |
sourceType | String | Yes | The type of source, which indicated where a service comes, like from the Mini Program apps or the merchant servers. The source type can be the following values:
Max. length: 32 characters. | "APP_CLIENT" |
customerId | String | Yes | An ID that uniquely identifies a Mini Program customer Max. length: 32 characters. | "2323423423432xxx" |
functionCode | String | No | This fields represents the interface name used in the Mini Program, for example, Note: This field is only required when the Max. length: 128 characters. | "/v1/payments/pay" |
proxyRequestHeader | String | Yes | The headers of a request. Max. length: 1024 characters. | "{\"Content-Type\":\"application/x-www-form-urlencoded\",\"appId\":\"eWALLET_name\",\"workspaceId\":\"default\",\"Cookie\":\"ALIPAYINTLJSESSIONID=Bzg1WFN18Z+wlZJKTVVRgl5gE7KSNhiVmomobilewalletxxx\"}" |
proxyRequestData | String | Yes | The data body of a request. Max. length: 4096 characters. | "operationType=ac.mobilepayment.instorepayment.cpm.encode&requestData=%5B%7B%22codeType%22%3A%22AC19%22%2C%22batchCount%22%3A3%2C%22generateInterval%22%3A30%2C%22mobileInStorePaymentInitInfo%22%3A%7B%22tid%22%3A%22XiraEsnY6M0DAGj81GgWvurj_C001F0A9141CEB3D%22%7D%2C%22extParams%22%3A%7B%7D%2C%22evnInfo%22%3A%7B%22terminalType%22%3A%22APP%22%2C%22sourcePlatform%22%3A%22MAIN_APP%22%2C%22osType%22%3A%22ios%22%2C%22osVersion%22%3A%2213.3%22%2C%22sdkVersion%22%3A%221.1.0%22%2C%22appVersion%22%3A%221.9.0%22%7D%7Dxxx" |
Response
Property | Data type | Required | Description | Example |
result | Yes | The request result, which contains information like status and error codes. | { "resultCode": "SUCCESS", "resultStatus": "S", "resultMesssage": "success" } | |
proxyResponseHeader | String | Yes | The header of a response. Max. length: 1024 characters. | "{\"Mgw-TraceId\":\"0ba7d3c0158192116765747128009xxx\",\"Result-Status\":\"1000\",\"Server-Time\":\"1581921168086\",\"Ac-UserId\":\"2088213892193712xxx\"}" |
proxyResponseData | String | Yes | The data body of a response. Max. length: 4096 characters. | "{\"currentServerTime\":\"1581921168000\",\"errorActions\":{},\"extendInfo\":{},\"mobileInStorePaymentEncodeResultInfos\":[{\"paymentCode\":\"2898879049608687904\",\"startServerTime\":\"1581921168000\"},{\"paymentCode\":\"2890734921560673492\",\"startServerTime\":\"1581921198000\"},{\"paymentCode\":\"2893940194773694019\",\"startServerTime\":\"1581921228000\"}],\"success\":true,\"traceId\":\"0ba7d3c0158192116765747128009xxx\"}" |
Result Process Logic
In the response, the result.resultStatus
field indicates the result of processing a request as follows.
resultStatus | Decription |
S | The request is sent successful. The corresponding |
U | The API status is unknown. The corresponding For details, see the Common error codes section. |
F | The request fails to send. The corresponding |
Error codes
Error codes are usually classified into the following categories:
- Common error codes: are common for all Mini Program OpenAPIs.
- API-specific error codes: this OpenAPI does not have its dedicated error codes.