syncUsedBenefit
POST /v1/marketing/benefit/used/sync
With this API call, an Independent Software Vendor (ISV) can synchronize the used benefit to our server when users redeem the benefit in a mini program. Then our server synchronizes the used benefit to the super app server for deactivating. When the deactivating is successful, the used benefit cannot be further used.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request parameters
Field | Data Type | Required | Description | Example |
benefitUseRequestId | String | Yes | Indicates the unique ID assigned by the ISV to identify a synchronization request of the used benefit.
Note: This field is an idempotency field. For synchronization requests of the used benefit, which are initiated with the same benefitUsedSyncRequestId, our server must return the same result. For details about API idempotency, see the Idempotency chapter. | - |
userId | String | Yes | Indicates the unique ID assigned by the super app to identify a user who collects the benefit..
| - |
clientCode | String | Yes | Indicates codes to identify different super apps. Valid values are:
| - |
benefitInstanceId | String | Yes | Indicates the unique ID assigned by the ISV to identify the benefit collected by a user.
| - |
benefitTemplateId | String | Yes | Indicates the unique ID assigned by the ISV to identify one type of benefit.
| - |
benefitUseDate | String | Yes | Indicates the date and time when the user redeems the benefit. The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:30". | UTC+05:30: "2019-04-04T12:08:56+05:30" UTC+0: "2019-04-04T12:08:56Z" |
useScene | String | Yes | Indicates the scenarios to use the benefit. Valid values are:
| - |
usedAmount | No | Indicates the used amount of the benefit.
| - | |
benefitCode | String | No | Indicates that the user can redeem the benefit with a code.
| - |
benefitUrl | String | No | Indicates that the user can redeem the benefit with an URL.
| - |
extendInfo | String | No | Indicates the extended information about this API.
| "{\"k1\":\"v1\",\"k2\":\"v2\"}" |
Response parameters
Field | Data type | Required | Description |
result | Yes | Indicates the request result, such as status and error codes. |
Result process logic
In the response, the result.resultStatus field indicates the result of processing a request. The following table describes each result status:
Result status | Description |
S | The used benefit is synchronized to our server successfully. The corresponding result.resultCode is |
U | The synchronization status of the used benefit is unknown. The corresponding result.resultCode is |
F | The used benefit failed to synchronize to our server. The corresponding result.resultCode and result.resultMessage are various based on different situations. For details, see the following Error codes section. |
Error codes
Error codes are usually classified into the following categories:
- Common error codes are common across all openAPIs for ISVs.
- API-specific error codes: The current OpenAPI does not have its dedicated error codes.
Samples
Request
{
"benefitUseRequestId": "20211111010101000001234",
"userId": "2088120000001234",
"clientCode": "ALIPAY_HK",
"benefitInstanceId": "20211212010101000001234",
"benefitTemplateId": "202001010101011234",
"benefitUseDate": "2019-04-04T12:08:56+05:30",
"useScene": "MINI_PROGRAM",
"usedAmount": {
"currency": "USD",
"value": "100"
},
"benefitCode": "QAZWSX123",
"benefitUrl": "",
"extendInfo": "{\"k1\":\"v1\",\"k2\":\"v2\"}"
}
Response
{
"result": {
"resultStatus": "S",
"resultCode": "",
"resultMessage": ""
}
}