sdkProxyMPP → Alipay+
The Mobile Payment Provider (MPP) server uses the sdkProxy API to proxy the request from the Alipay+ NFC SDK to the Alipay+ server.
In the Alipay+ NFC scenario, the request proxy steps are listed below:
- When making a request, the Alipay+ NFC SDK first sends a request body to the MPP app.
- The MPP app constructs an HTTPS request body using the request body that the SDK provides and then sends the HTTPS request body to the MPP server.
- The MPP server obtains the customer ID and then constructs an HTTPS request by adding the request header and customer ID into the HTTPS request body provided by the MPP app. Then the MPP server sends the HTTPS request to the Alipay+ server.
When using this API, the MPP server needs to obtain only the customer ID and add it to the request body. Then, the MPP server sends the request to the Alipay+ server through this API.
Note: The expiry time of the sdkProxy API is 10 seconds. The MPP server needs to set the connection expiry time between Alipay+ and the MPP server to longer than 10 seconds.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Note:
- Set the data type of each parameter (except array) as String. This means that you must use double quotation marks (" ") to enclose the parameter value. Examples:
- If the data type of a parameter is Integer and its value is 20, set it as "20".
- If the data type of a parameter is Boolean and its value is
true, set it as "true".
- For optional parameters that are not required in your case, you can take one of the following actions:
- Exclude the parameters from the request body.
- Set the parameter values as
null(without the double quotation marks).Do NOT leave the optional parameters empty by setting their values as
""; otherwise, an error might occur.
Request parameters
sdkRequestHeader String REQUIRED
The SDK request header.
This parameter is encapsulated within the SDK and sent by the MPP client. The MPP server constructs HTTPS request with the content of this parameter. The MPP server should not modify the content.
sdkRequestData String REQUIRED
The SDK request data body.
This parameter is encapsulated within the SDK and sent by the MPP client. The MPP server constructs HTTPS request with the content of this parameter. The MPP server should not modify the content.
customerId String REQUIRED
The unique ID that is assigned by the MPP to identify a customer.
Response parameters
result Result REQUIRED
The result of the business processing, including the result status, result code, and result message. For more information about how to return the result, see How to return the result.
sdkResponseHeader String CONDITIONAL
The SDK response header.
The parameter is mandatory when result.resultCode is SUCCESS.
sdkResponseData String CONDITIONAL
The SDK response data body.
The parameter is mandatory when result.resultCode is SUCCESS.
Request
Response
Sample
The following sample code shows how the MPP server constructs and sends a HTTPS request by adding customer ID into the MPP client's request body.
Note: This sample code only provides a general implementation on how to add customerId into the request body, some unrelated steps are skipped.
Alipay+ server processes the request and returns the response to the MPP server.
Note: The reponse data must be returned to the SDK entirely. If the MPP app returns null data or no data is returned, the SDK will determine that the request has failed.
Result/Error codes
| Code | Value | Message |
|---|---|---|
| SUCCESS | S | Success |
| ACCESS_DENIED | F | Access is denied. |
| INVALID_API | F | The called API is invalid or not active. |
| INVALID_CLIENT | F | The client is invalid. |
| INVALID_SIGNATURE | F | The signature is invalid. |
| KEY_NOT_FOUND | F | The key is not found. |
| MEDIA_TYPE_NOT_ACCEPTABLE | F | The server does not implement the media type that is acceptable to the client. |
| METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTPS method. |
| PARAM_ILLEGAL | F | Illegal parameters. For example, non-numeric input, invalid date. |
| PROCESS_FAIL | F | A general business failure occurred. Do not retry. |
| REQUEST_TRAFFIC_EXCEED_LIMIT | U | The request traffic exceeds the limit. |
| UNKNOWN_EXCEPTION | U | An API call failed, which is caused by unknown reasons. |