# LoyaltyProgram

LoyaltyProgram

## Search for a loyalty program membership

> Search for (look up) a loyalty program membership. \
> The preferred and main search criteria is \*\*mobile number\*\*, \
> but email can be used when mobile number is not available.\
> \
> Country code must be with a plus sign, e.g. +47 for Norway.\
> If country code is missing, the default country code of the tenant \
> is used.<br>

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"LoyaltyMemberListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/LoyaltyMemberResponseSchema"}}}}}}}},"schemas":{"LoyaltyMemberResponseSchema":{"title":"LoyaltyMemberResponseSchema","type":"object","required":["loyaltyId","firstName","lastName","address","postalCode","city","countryCode","email","mobile","consents","customerUid","origin","displayName"],"properties":{"loyaltyId":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"description":"ISO 3166-1: 2 characters representation of country","type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"mobile":{"type":"string"},"consents":{"type":"array","items":{"type":"string"}},"customerUid":{"$ref":"#/components/schemas/UID"},"origin":{"type":"string"},"displayName":{"type":"string"}}},"EmailTYPE":{"title":"Email","type":"string"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}},"requestBodies":{"LoyaltyMemberSearchRequest":{"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","description":"full mobile number or email"}}}}}}}},"paths":{"/tenants/{tenantUid}/customers/loyalty/search":{"post":{"summary":"Search for a loyalty program membership","responses":{"200":{"$ref":"#/components/responses/LoyaltyMemberListResponse"}},"operationId":"post-customers-loyalty-search","tags":["LoyaltyProgram"],"description":"Search for (look up) a loyalty program membership. \nThe preferred and main search criteria is **mobile number**, \nbut email can be used when mobile number is not available.\n\nCountry code must be with a plus sign, e.g. +47 for Norway.\nIf country code is missing, the default country code of the tenant \nis used.\n","requestBody":{"$ref":"#/components/requestBodies/LoyaltyMemberSearchRequest"},"parameters":[]}}}}
```

## Enroll new customer to loyalty program

> Enroll new customer to loyalty program.\
> If the mobile number is not in the country of the tenant you must add the country code (e.g. +358 for Finland).\
> The store is where the enroll was made from.\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"LoyaltyMemberEnrollRequest":{"content":{"application/json":{"schema":{"type":"object","required":["mobile","storeUid"],"properties":{"mobile":{"type":"string"},"mobileCountryCode":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"}}}}}}},"schemas":{"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}}},"paths":{"/tenants/{tenantUid}/customers/loyalty":{"post":{"summary":"Enroll new customer to loyalty program","tags":["LoyaltyProgram"],"responses":{"204":{"description":"No Content"}},"operationId":"post-customers-loyalty-enroll","description":"Enroll new customer to loyalty program.\nIf the mobile number is not in the country of the tenant you must add the country code (e.g. +358 for Finland).\nThe store is where the enroll was made from.\n\nRequired permissions: CUSTOMER","requestBody":{"$ref":"#/components/requestBodies/LoyaltyMemberEnrollRequest"}}}}}
```

## Get loyalty program member details for customer

> Get loyalty program member details for customer.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerExternalResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerExternalResponseSchema"}}}}},"schemas":{"CustomerExternalResponseSchema":{"title":"CustomerExternalResponseSchema","type":"object","properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"countryCode":{"description":"ISO 3166-1: 2 characters representation of country","type":"string"},"createdAt":{"format":"date-time","type":"string"},"customerUid":{"$ref":"#/components/schemas/UID"},"customerType":{"$ref":"#/components/schemas/CustomerTypeENUM"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"externalId":{"type":"string"},"firstname":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastname":{"type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"mobile":{"type":"string"},"postalCode":{"type":"string"},"pricelistUid":{"$ref":"#/components/schemas/OptionalUID"},"vatNumber":{"$ref":"#/components/schemas/VatNumberTYPE"},"origin":{"type":"string"}},"required":["address","city","companyName","countryCode","createdAt","customerUid","customerType","email","externalId","firstname","lastModifiedAt","lastname","ledgerNumber","mobile","postalCode","pricelistUid","vatNumber","origin"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CustomerTypeENUM":{"enum":["COMPANY","PERSON","B2B"],"title":"CustomerTypeENUM","type":"string"},"EmailTYPE":{"title":"Email","type":"string"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"VatNumberTYPE":{"description":"VAT identification number for value added tax reporting purposes.","title":"VatNumber","type":"string"}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/loyalty":{"get":{"summary":"Get loyalty program member details for customer","tags":["LoyaltyProgram"],"responses":{"200":{"$ref":"#/components/responses/CustomerExternalResponse"}},"operationId":"get-customers-customerUid-loyalty","description":"Get loyalty program member details for customer."}}}}
```

## Enroll existing customer to loyalty program

> Enroll existing customer to loyalty program. The store is where the enroll is made from.\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponseSchema"}}},"description":"Example response"}},"schemas":{"CustomerResponseSchema":{"title":"CustomerResponseSchema","type":"object","description":"CustomerResponseSchema","required":["address","city","companyName","countryCode","createdAt","customerUid","customerParentUid","customerType","email","externalId","firstname","lastModifiedAt","lastname","mobile","postalCode","pricelistUid","vatNumber","origin","addresses","contacts","extensions","consents","loyaltyId","displayName","credit","paymentTerms","internalNote","accountManager","ehf","customerGroupUids","defaultStore","relevance"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"countryCode":{"description":"ISO 3166-1: 2 characters representation of country","type":"string"},"createdAt":{"format":"date-time","type":"string"},"customerUid":{"$ref":"#/components/schemas/UID"},"customerParentUid":{"description":"References another customer, establishing it as a department under the main customer. Only applicable when customerType is COMPANY.","$ref":"#/components/schemas/OptionalUID"},"customerType":{"$ref":"#/components/schemas/CustomerTypeENUM"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"externalId":{"type":"string"},"firstname":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastname":{"type":"string"},"ledgerNumber":{"type":"string","deprecated":true,"description":"Deprecated. Use ledgerNumber in accountingConfigs instead"},"mobile":{"type":"string"},"postalCode":{"type":"string"},"pricelistUid":{"$ref":"#/components/schemas/OptionalUID"},"vatNumber":{"$ref":"#/components/schemas/VatNumberTYPE"},"origin":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/CustomerAddressResponseSchema"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/CustomerContactResponseSchema"}},"extensions":{"type":"array","items":{"$ref":"#/components/schemas/CustomerExtensionResponseSchema"}},"consents":{"type":"array","items":{"$ref":"#/components/schemas/CustomerConsentStatusSchema"}},"loyaltyId":{"type":"string"},"displayName":{"type":"string"},"credit":{"$ref":"#/components/schemas/CustomerCreditResponseSchema"},"paymentTerms":{"type":"integer"},"internalNote":{"type":"string"},"accountManager":{"$ref":"#/components/schemas/AccountManagerResponseSchema"},"ehfEnabled":{"type":"boolean","description":"Deprecated: Use ehf -> enabled instead"},"ehf":{"$ref":"#/components/schemas/CustomerEhfResponseSchema"},"customerGroupUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"defaultStore":{"$ref":"#/components/schemas/CustomerStoreResponseSchema"},"relevance":{"type":"number"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"CustomerTypeENUM":{"enum":["COMPANY","PERSON","B2B"],"title":"CustomerTypeENUM","type":"string"},"EmailTYPE":{"title":"Email","type":"string"},"VatNumberTYPE":{"description":"VAT identification number for value added tax reporting purposes.","title":"VatNumber","type":"string"},"CustomerAddressResponseSchema":{"title":"CustomerAddressResponseSchema","type":"object","required":["address","city","companyName","firstname","lastname","countryCode","email","phone","postalCode","type","customerAddressUid","displayName"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"countryCode":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"phone":{"type":"string"},"postalCode":{"type":"string"},"type":{"$ref":"#/components/schemas/CustomerAddressTypeENUM"},"customerAddressUid":{"type":"string"},"displayName":{"type":"string"}}},"CustomerAddressTypeENUM":{"enum":["DELIVERY_ADDRESS","INVOICE_ADDRESS"],"title":"CustomerAddressTypeENUM","type":"string"},"CustomerContactResponseSchema":{"title":"CustomerContactResponseSchema","type":"object","description":"CustomerContactResponseSchema","required":["firstname","lastname","email","mobile","createdAt","lastModifiedAt","customerContactUid","extensions","displayName","role"],"properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"mobile":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedAt":{"type":"string","format":"date-time"},"customerContactUid":{"type":"string"},"extensions":{"type":"array","items":{"$ref":"#/components/schemas/CustomerContactExtensionResponseSchema"}},"displayName":{"type":"string"},"role":{"$ref":"#/components/schemas/CustomerContactRoleENUM"}}},"CustomerContactExtensionResponseSchema":{"description":"CustomerContactExtensionResponseSchema","title":"CustomerContactExtensionResponseSchema","type":"object","properties":{"extensionCode":{"$ref":"#/components/schemas/CustomerExtensionCodeENUM"},"organizationUid":{"$ref":"#/components/schemas/UID"}},"required":["extensionCode","organizationUid"]},"CustomerExtensionCodeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| TWO_INVOICE | The Two Invoice extension.|","enum":["TWO_INVOICE"],"title":"CustomerExtensionCodeENUM","type":"string"},"CustomerContactRoleENUM":{"title":"CustomerContactRoleENUM","type":"string","enum":["ADMIN","PURCHASER","ACCOUNTING","NONE"]},"CustomerExtensionResponseSchema":{"title":"CustomerExtensionResponseSchema","description":"CustomerExtensionResponseSchema","type":"object","properties":{"extensionCode":{"$ref":"#/components/schemas/CustomerExtensionCodeENUM"},"organizationUid":{"$ref":"#/components/schemas/UID"}},"required":["extensionCode","organizationUid"]},"CustomerConsentStatusSchema":{"title":"CustomerConsentStatusSchema","type":"object","required":["consentUid","name","status","source","createdAt"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"status":{"type":"boolean"},"source":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"CustomerCreditResponseSchema":{"title":"CustomerCreditResponseSchema","required":["limit","balance"],"properties":{"limit":{"type":"integer"},"balance":{"type":"integer"}},"type":"object"},"AccountManagerResponseSchema":{"title":"AccountManagerResponseSchema","type":"object","required":["tenantUserUid","displayName","userCode"],"properties":{"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"displayName":{"type":"string"},"userCode":{"type":"string"}}},"CustomerEhfResponseSchema":{"title":"CustomerEhfResponseSchema","type":"object","required":["enabled","address"],"properties":{"enabled":{"type":"boolean","description":"EHF is enabled for this customer"},"address":{"type":"string","description":"EHF address"}}},"CustomerStoreResponseSchema":{"title":"CustomerStoreResponseSchema","type":"object","nullable":true,"required":["name","storeUid"],"properties":{"name":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"}}}},"requestBodies":{"LoyaltyMemberEnrollExistingCustomerRequest":{"content":{"application/json":{"schema":{"type":"object","required":["storeUid"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"}}}}}}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/loyalty":{"post":{"summary":"Enroll existing customer to loyalty program","tags":["LoyaltyProgram"],"responses":{"200":{"$ref":"#/components/responses/CustomerResponse"}},"operationId":"post-customers-customerUid-loyalty","description":"Enroll existing customer to loyalty program. The store is where the enroll is made from.\n\nRequired permissions: CUSTOMER","requestBody":{"$ref":"#/components/requestBodies/LoyaltyMemberEnrollExistingCustomerRequest"}}}}}
```

## List loyalty program discounts for customer

> List available loyalty program member discounts for customer.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"LoyaltyDiscountListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/LoyaltyDiscountResponseSchema"}}}}}}}},"schemas":{"LoyaltyDiscountResponseSchema":{"title":"LoyaltyDiscountResponseSchema","type":"object","required":["discountCode","title","description","validFrom","validTo","discountType","discountValue","maxUsage","timesUsed","productSkus"],"properties":{"discountCode":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"validFrom":{"type":"string","format":"date-time"},"validTo":{"type":"string","format":"date-time"},"discountType":{"$ref":"#/components/schemas/DiscountTypeENUM"},"discountValue":{"type":"integer"},"maxUsage":{"type":"integer"},"timesUsed":{"type":"integer"},"productSkus":{"type":"array","items":{"type":"string"}}}},"DiscountTypeENUM":{"title":"DiscountTypeENUM","type":"string","enum":["PERCENTAGE","AMOUNT"]}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/loyalty/discounts":{"get":{"summary":"List loyalty program discounts for customer","tags":["LoyaltyProgram"],"responses":{"200":{"$ref":"#/components/responses/LoyaltyDiscountListResponse"}},"operationId":"get-customers-loyalty-discounts","description":"List available loyalty program member discounts for customer.","parameters":[]}}}}
```

## Get loyalty program points for customer

> Get available loyalty program member points for customer.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerLoyaltyPointResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerLoyaltyPointResponseSchema"}}}}},"schemas":{"CustomerLoyaltyPointResponseSchema":{"title":"CustomerLoyaltyPointResponseSchema","type":"object","required":["customerUid","balance","currency","expiringBalance","expirationDate"],"properties":{"customerUid":{"$ref":"#/components/schemas/UID"},"balance":{"type":"integer"},"currency":{"type":"string"},"expiringBalance":{"type":"integer"},"expirationDate":{"type":"string","format":"date-time"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/loyalty/points":{"get":{"summary":"Get loyalty program points for customer","tags":["LoyaltyProgram"],"responses":{"200":{"$ref":"#/components/responses/CustomerLoyaltyPointResponse"}},"operationId":"get-customers-loyalty-points","description":"Get available loyalty program member points for customer.","parameters":[]}}}}
```

## Get loyalty program member balance for customer on order.

> Get loyalty program member balance for customer on order.\
> \- If order total > 0, the response shows balance to use as payment on order.\
> \- If order total on order < 0, the response shows bonus point that can be refunded on order. <br>

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"LoyaltyProgram","description":"LoyaltyProgram"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"OrderLoyaltyPointResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderLoyaltyPointResponseSchema"}}}}},"schemas":{"OrderLoyaltyPointResponseSchema":{"title":"OrderLoyaltyPointResponseSchema","type":"object","required":["balance"],"properties":{"balance":{"type":"integer"}}}}},"paths":{"/tenants/{tenantUid}/orders/{orderUid}/loyalty":{"get":{"summary":"Get loyalty program member balance for customer on order.","tags":["LoyaltyProgram"],"responses":{"200":{"$ref":"#/components/responses/OrderLoyaltyPointResponse"}},"operationId":"get-orders-loyalty-points","description":"Get loyalty program member balance for customer on order.\n- If order total > 0, the response shows balance to use as payment on order.\n- If order total on order < 0, the response shows bonus point that can be refunded on order. \n","parameters":[]}}}}
```
