docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Customer
  4. Customer Memberships

Customer Memberships

General

Learn how to get, update and delete customer memberships.

Admin API

Create a new customer membership.

This method is used to create a new Customer Membership.

let response = await adminApi.apis.Customers.createCustomerMembership({shopKey: shopKey, countryCode: countryCode, customerIdentifier: customerIdentifier}, {requestBody: customerMembership});
let customerMembership = response.body;

Create a Customer Membership

let customerMembership = {
  "isActive": true,
  "membershipTypeKey": "payback",
  "membershipAccountNumber": "1234567890"
};

let response = await adminApi.apis.Customers.createCustomerMembership({shopKey: 'ms', countryCode: 'DE', customerIdentifier: "key=my-key"}, {requestBody: customerMembership});
customerMembership = response.body;

console.log(customerMembership.id);

Get Memberships

This endpoint is not bound to a specific shop country; however, it still requires the shop country details, identified by the shopKey and countryCode, without filtering by the shop country.

SCAYLE allows you to retrieve customer memberships by customer reference key or ID.

This method can be used to get customer memberships by customer reference key or ID.

await adminApi.apis.Customers.getCustomerMemberships({shopKey: shopKey, countryCode: countryCode, customerIdentifier: customerIdentifier});

List Memberships

Get a list of customer's memberships:

let response = await adminApi.apis.Customers.getCustomerMemberships({shopKey: 'ms', countryCode: 'DE', customerIdentifier: "key=my-key"});
let customerMemberships = response.body.entities;

customerMemberships.forEach(
    membership => console.log(membership.id)
);

Delete customer memberships

SCAYLE allows users to delete a customer membership by its ID.

This method is used to delete customer memberships.

await adminApi.apis.Customers.deleteCustomerMembership({shopKey: shopKey, countryCode: countryCode, membershipId: membershipId});

Update customer membership

SCAYLE allows you to update a customer membership by its ID.

Parameters

ParameterDetails
idInteger READ-ONLY
isActive

Boolean

Membership state.

typeKey

String

Membership type key.

accountNumber

String

Membership account number.

createdAt

String READ-ONLY

Timestamp when the membership is created.

updatedAt

String READ-ONLY

Timestamp when the membership is updated.

This method is used to update existing customer membership.

let response = await adminApi.apis.Customers.updateCustomerMembership({shopKey: shopKey, countryCode: countryCode, membershipId: membershipId}, {requestBody: customerMembership});
let customerMembership = response.body;

Update a customer's membership

let customerMembership = {
  "isActive": true,
  "membershipTypeKey": "payback",
  "membershipAccountNumber": "1234567890"
};

let response = await client.apis.Customers.updateCustomerMembership({shopKey: 'ms', countryCode: 'DE', membershipId: 123}, {requestBody: customerMembership});
customerMembership = response.body;

console.log(customerMembership.id);