Newer Version Available

This content describes an older version of this product. View Latest

Member Benefits

Retrieve a list of benefits for a member, while asynchronously requesting data from the Member Benefits API.

Resource

1getMemberBenefits(for:version:devMode:)

Signature

1public func getMemberBenefits(
2    for memberId: String,
3    version: String = LoyaltyAPIVersion.defaultVersion,
4    devMode: Bool = false) async throws -> [BenefitModel]

Input Parameters

Parameter Type Description Required or Optional
devMode Boolean Indicates whether the request is run in developer mode (true) or not (false). Optional
memberId String Identifier of the member whose benefits are being retrieved. Required
version String Version of the API. The request body is available in version 55.0 and later. Optional

Return Value

A BenefitModel instance of type:

1public struct BenefitModel : Identifiable, Codable

Sample Output

1{
2    "memberBenefits": [
3        {
4            "benefitId": "0ji4x0000008REdAAM",
5            "benefitName": "Extended Returns (7 Days)",
6            "benefitTypeId": "0jh4x0000008REQAA2",
7            "benefitTypeName": "Extended Returns",
8            "createdRecordId": null,
9            "createdRecordName": null,
10            "endDate": null,
11            "isActive": true,
12            "memberBenefitStatus": null,
13            "startDate": null
14        },
15        {
16            "benefitId": "0ji4x0000008REjAAM",
17            "benefitName": "Standard Support",
18            "benefitTypeId": "0jh4x0000008REXAA2",
19            "benefitTypeName": "Customer Support",
20            "createdRecordId": null,
21            "createdRecordName": null,
22            "endDate": null,
23            "isActive": true,
24            "memberBenefitStatus": null,
25            "startDate": null
26        },
27        {
28            "benefitId": "0ji4x0000008REeAAM",
29            "benefitName": "Free Subscription",
30            "benefitTypeId": "0jh4x0000008REXAA2",
31            "benefitTypeName": "Free Subscription",
32            "createdRecordId": null,
33            "createdRecordName": null,
34            "endDate": null,
35            "isActive": true,
36            "memberBenefitStatus": null,
37            "startDate": null
38        },
39        {
40            "benefitId": "0ji4x0000008REZAA2",
41            "benefitName": "Free Shipping",
42            "benefitTypeId": "0jh4x0000008REQAA2",
43            "benefitTypeName": "Free Shipping",
44            "createdRecordId": null,
45            "createdRecordName": null,
46            "endDate": null,
47            "isActive": true,
48            "memberBenefitStatus": null,
49            "startDate": null
50        },
51        {
52            "benefitId": "0ji4x0000008REiAAM",
53            "benefitName": "Tier Exclusive Offer",
54            "benefitTypeId": "0jh4x0000008REXAA2",
55            "benefitTypeName": "Tier Exclusive Offer",
56            "createdRecordId": null,
57            "createdRecordName": null,
58            "endDate": null,
59            "isActive": true,
60            "memberBenefitStatus": null,
61            "startDate": null
62        },
63        {
64            "benefitId": "0ji4x0000008REfAAM",
65            "benefitName": "Complimentry Voouchers",
66            "benefitTypeId": "0jh4x0000008REQAA2",
67            "benefitTypeName": "Complimentry Voouchers",
68            "createdRecordId": null,
69            "createdRecordName": null,
70            "endDate": null,
71            "isActive": true,
72            "memberBenefitStatus": null,
73            "startDate": null
74        }
75    ]
76}

Output Parameters

Parameter Type Description
benefitId String The ID of the benefit available for the member.
benefitName String The name of the benefit available for the member.
benefitTypeId String The ID of the associated benefit type record.
benefitTypeName String The name of the associated benefit type.
createdRecordId String The ID of the record created during benefit assignment.
createdRecordName String The display name of the record created during benefit assignment.
description String The description of the benefit available to a loyalty program member.
endDate String The date the benefit expires.
isActive Boolean Indicates whether the benefit is active (true) or not (false).
memberBenefitStatus String The status of the benefit available for the member.
startDate String The date from when the benefit applies to a member.