Redeem loyalty points

Once you have set up a loyalty program on an external system, you allow your shoppers to redeem loyalty points against a program.

To do this, enroll the shoppers into the program. You can enroll members in a loyalty program by providing loyalty details in their profiles using the Commerce Web API.

Use webhooks to configure loyalty point redemption

The Order Submit webhook, which is described in detail in the Order Submit Webhook section, includes loyalty details in the payload. This webhook gets the secondary monetary currency and exchange rate properties. The following example is of a POST request that identifies the loyalty programs and membership ID of the profile associated with the order.

  "loyaltyPrograms": [
  {
    "programId": "program1",
    "membershipId": null,
    "programName":"XTRAMILES",
    "status":"RequestForEnrollment"
  },
  {
    "programId": "program2",
    "membershipId": null,
    "programName":"XTRAREWARDS",
    "status":"RequestForEnrollment"
  }

The Profile webhook contains loyalty program nomination in the payload. Loyalty membership details are stored in the profile properties and include the program and membership ID.

Use endpoints to configure loyalty point redemption

Endpoints allow you to configure loyalty programs for a site and are used during nomination to loyalty flow for validation. During nomination, all programs that are linked to the profile are included in the payload of Register/Update shopper webhook.

The following properties are used by the profile endpoint to recognize and redeem loyalty point data.

Property Description
programId The ID of the loyalty program.
programName The name of the loyalty program.
membershipId The ID that indicates the shopper is a member of the loyalty program.
status

Indicates the status of the enrollment within the loyalty program. The status can be:

Enrolled – The profile has been successfully enrolled and has a membership number. This membership number can be saved in Oracle Commerce along with the loyalty program ID.

Unenrolled – Indicates that the profile has been successfully removed from the loyalty system.

Failed – Indicates that the loyalty system failed to enroll a program.

To create a new profile with loyalty data, issue a POST request in /ccadmin/v1/profile. For example:

{
  "firstName": "John",
  "lastName": "Doe",
  "profileType": "b2b_user",
  "roles": [
    {
      "function": "buyer",
      "relativeTo": {
        "id": "900004"
      }
    }
  ],
  "receiveEmail": "yes",
  "active": true,
  "parentOrganization": "900004",
  "email": "jdoe@example.com",
  "daytimeTelephoneNumber": "212-555-1977",
  "loyaltyPrograms": [
  {
    "programId": "program1",
    "membershipId": null,
    "programName":"XTRAMILES",
    "status":"RequestForEnrollment"
  },
  {
    "programId": "program2",
    "membershipId": null,
    "programName":"XTRAREWARDS",
    "status":"RequestForEnrollment"
  }
 ]
}

You can add loyalty programs at any time to an existing profile by issuing a PUT request in /ccadmin/v1/profile/{profile_id}.

Understand enrollment into loyalty programs

When shoppers are enrolled into loyalty programs, Oracle Commerce stores the details of the shopper’s enrollment in their profile. There are two ways to configure enrollment. You can decide to enroll all new shoppers, so that when you create a profile it triggers the profile webhook sending the enrollment request to an integrated loyalty system with the program name associated with your site. Or you can create a dynamic property for a profile.

Create custom properties

For example, you could create custom properties for the order, which allows the order to determine accrued points, point types and the loyalty transaction ID:

PUT /ccadmin/v1/orderTypes/order
{
  "properties": {
    "loyalty_transaction_id": {
      "internalOnly": true,
      "label": "Loyalty transaction Id",
      "type": "shortText",
      "uiEditorType": "shortText"
    },
    "loyalty_points_accrued": {
      "internalOnly": false,
      "label": "Loyalty points accrued",
      "type": "number",
      "default":0,
      "uiEditorType": "number"
    },
    "accrued_point_type": {
      "internalOnly": false,
      "label": "Point type",
      "type": "shortText",
      "uiEditorType": "shortText"
    }
}

You could also create custom properties for the profile, which allows the shopper to enroll in a loyalty program. For example:

PUT /ccadmin/v1/shopperTypes/user
{
  "properties": {
    }
    "enroll_to_loyalty": {
      "internalOnly": false,
      "label": "Enroll for Loyalty program",
      "type": "checkbox",
      "uiEditorType": "checkbox"
    }
  }
}

Once the loyalty details widget is placed on the profile layout (storefront), a shopper has the ability to see their loyalty details by accessing My Account and seeing the display of their loyalty status. This information is stored on the shopper’s profile in the properties you created.

Note: When you create custom properties, make sure that your property name contains an underscore (_). For example, you could create a custom property named CustomerProfile_PropertyName. Once you have created this property, you must customize the integration code and replace any references with the new custom property name.

Use loyalty-specific widgets

There are two loyalty-specific widgets associated with loyalty programs, the Loyalty Details widget and the Loyalty Payment widget.

The Loyalty Details widget, when added to a layout, displays the loyalty details of a registered shopper. This widget displays only one loyalty program detail per shopper, but can be modified to display all of a shopper’s loyalty programs memberships.

When the Loyalty Details widget is placed on a page layout that is accessible by registered shoppers, it gets the shopper loyalty information and populates the loyalty view model. Additionally, you can add the logic within the Loyalty Details widget to a global widget so that the loyalty view model is populated with the program details.

For additional information on the Loyalty Details widget, refer to Appendix: Layout Widgets and Elements.

The Loyalty Payment widget displays the payment method as loyalty points when the gateway is enabled. For detailed information on the Loyalty Payment widget, refer to the Appendix: Layout Widgets and Elements. For information on gateways, refer to Integrate with a Loyalty Point Payment Gateway.