Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Member Vouchers
Retrieve a list of vouchers issued to the member, while asynchronously requesting data
from the Member Vouchers API.
Resource
1getVouchers(membershipNumber:voucherStatus:pageNumber:productId:productCategoryId:productName:productCategoryName:sortBy:sortOrder:version:devMode:)Signature
1public func getVouchers(
2 membershipNumber: String,
3 voucherStatus: [VoucherStatus]? = nil,
4 pageNumber: Int? = nil,
5 productId: [String]? = nil,
6 productCategoryId: [String]? = nil,
7 productName: [String]? = nil,
8 productCategoryName: [String]? = nil,
9 sortBy: SortBy? = nil,
10 sortOrder: SortOrder? = nil,
11 version: String = LoyaltyAPIVersion.defaultVersion,
12 devMode: Bool = false) async throws -> [VoucherModel]Input Parameters
| Parameter Name | Type | Description | Required or Optional |
|---|---|---|---|
| membershipNumber | String | Unique identifier of the member whose vouchers are being retrieved. | Required |
| devMode | Boolean | Indicates whether the request is run in developer mode (true) ot not (false). | Optional |
| pageNumber | Integer | The page number to be returned. If you don’t specify a value, the first page is returned. Each page contains 200 vouchers, sorted by their date of creation. | Optional |
| productCategoryId | String | The ID of a product category associated with the member vouchers to be retrieved. You can specify up to 20 product category IDs. | Optional |
| productCategoryName | String | The product category name associated with the vouchers to be retrieved. You can specify up to 20 product categories. | Optional |
| productId | String | The product ID associated with the vouchers to be retrieved. You can specify up to 20 product IDs. | Optional |
| productName | String | The product name associated with the vouchers to be retrieved. You can specify up to 20 product names. | Optional |
| voucherStatus | String | The status of the member vouchers to filter the API response.
Possible values are:
|
Optional |
| sortBy | String | The voucher field for sorting the API response. The default value
is ExpirationDate. Possible
values are:
|
Optional |
| sortOrder | String | The sort order of the API response. The default value is Ascending. Possible values are:
|
Optional |
| version | String | Version of the API. The request body is available in version 55.0 and later. | Optional |
Sample Output
1{
2 "voucherCount": 4,
3 "vouchers": [
4 {
5 "description": "20% discount on children group party at selected event centers.",
6 "discountPercent": 50,
7 "effectiveDate": "2023-01-01",
8 "expirationDate": "2023-04-01",
9 "isVoucherDefinitionActive": true,
10 "isVoucherPartiallyRedeemable": false,
11 "promotionId": "0c8RO0000000ILdYAM",
12 "promotionName": "Birthday Promotion",
13 "redeemedValue": 0.0,
14 "remainingValue": 0.0,
15 "status": "Issued",
16 "type": "DiscountPercentage",
17 "voucherCode": "VOU10101011",
18 "voucherDefinition": "Birthday Discount Voucher",
19 "voucherId": "0kDRO00000000Hk2AI",
20 "voucherImageUrl": "https://thumbs.dreamstime.com/b/10-percent-discount-24471598.jpg",
21 "voucherNumber": "00000001"
22 },
23 {
24 "description": "20% discount on children group party at selected event centers.",
25 "discountPercent": 40,
26 "effectiveDate": "2023-01-01",
27 "expirationDate": "2023-04-01",
28 "isVoucherDefinitionActive": true,
29 "isVoucherPartiallyRedeemable": false,
30 "promotionId": "0c8RO0000000ILdYAM",
31 "promotionName": "Birthday Promotion",
32 "redeemedValue": 0.0,
33 "remainingValue": 0.0,
34 "status": "Redeemed",
35 "type": "DiscountPercentage",
36 "voucherCode": "VOU10101012",
37 "voucherDefinition": "Birthday Discount Voucher",
38 "voucherId": "0kDRO00000000Hp2AI",
39 "voucherImageUrl": "https://thumbs.dreamstime.com/b/10-percent-discount-24471598.jpg",
40 "voucherNumber": "00000002"
41 },
42 {
43 "description": "20% discount on children group party at selected event centers.",
44 "discountPercent": 40,
45 "effectiveDate": "2023-01-01",
46 "expirationDate": "2023-06-01",
47 "isVoucherDefinitionActive": true,
48 "isVoucherPartiallyRedeemable": false,
49 "promotionId": "0c8RO0000000ILdYAM",
50 "promotionName": "Birthday Promotion",
51 "redeemedValue": 0.0,
52 "remainingValue": 0.0,
53 "status": "Redeemed",
54 "type": "DiscountPercentage",
55 "voucherCode": "VOU10101012",
56 "voucherDefinition": "Birthday Discount Voucher",
57 "voucherId": "0kDRO00000000Hp2BI",
58 "voucherImageUrl": "https://thumbs.dreamstime.com/b/10-percent-discount-24471598.jpg",
59 "voucherNumber": "00000003"
60 },
61 {
62 "description": "20% discount on children group party at selected event centers.",
63 "discountPercent": 40,
64 "effectiveDate": "2023-01-01",
65 "expirationDate": "2023-05-01",
66 "isVoucherDefinitionActive": true,
67 "isVoucherPartiallyRedeemable": false,
68 "promotionId": "0c8RO0000000ILdYAH",
69 "promotionName": "Birthday Promotion",
70 "redeemedValue": 0.0,
71 "remainingValue": 0.0,
72 "status": "Expired",
73 "type": "DiscountPercentage",
74 "voucherCode": "VOU10101012",
75 "voucherDefinition": "Birthday Discount Voucher",
76 "voucherId": "0kD43872679RO00000000Hp2AI",
77 "voucherImageUrl": "https://thumbs.dreamstime.com/b/10-percent-discount-24471598.jpg",
78 "voucherNumber": "00000004"
79 }
80 ]
81}Output Parameters
| Property Name | Type | Description |
|---|---|---|
| attributesUrl | String | The URL of the attribute associated with the voucher. |
| currencyIsoCode | String | The currency ISO code in which the member has redeemed the voucher. |
| description | String | The description of the voucher issued to the member. |
| discountPercent | Integer | The discount percentage that's offered to the member by the voucher. |
| effectiveDate | String | The date the member can redeem the voucher. |
| expirationDate | String | The date the voucher expires. |
| faceValue | Double | The value that the member can redeem using the voucher. |
| id | String | The ID of the voucher record. |
| isVoucherDefinitionActive | Boolean | Indicates whether the voucher definition associated with the voucher is active (true) or not (false). |
| isVoucherPartiallyRedeemable | Boolean | Indicates whether the voucher can be redeemed across multiple transactions (true) or only one transaction (false). |
| partnerAccount | String | The name of the partner associated with the voucher's voucher definition. |
| product | String | The name of the product associated with the voucher definition. |
| productCategory | String | The product category associated with the voucher's voucher definition. |
| productCategoryId | String | The ID of product category associated with the voucher's voucher definition. |
| productId | String | The ID of the product associated with the voucher definition. |
| promotionId | String | The ID of the promotion for which the voucher is issued. |
| promotionName | String | The name of the promotion for which the voucher is issued. |
| redeemedValue | Double | The value that the member has already redeemed from a partially redeemable voucher. |
| remainingValue | Double | The remaining value of the voucher after partial redemption. |
| status | String | The status of the voucher. |
| type | String | The type of voucher issued to the member. |
| useDate | String | The date the voucher was redeemed. |
| voucherCode | String | The code of the voucher. |
| voucherDefinition | String | The name of the voucher definition used to issue the voucher to the member. |
| voucherImageUrl | String | The URL of the image associated with the voucher definition.
In the promotion record, enter an image URL and ensure that the webpage that hosts the image is publicly accessible. |
| voucherNumber | String | The unique number of the voucher. |