Revoke Enrolled and Issued Promotions

Revoke promotions that a customer is enrolled in

This API is used to revoke the enrolment and issual of a loyalty promotion for one or more customers in a loyalty program.

Refer to the documentation on loyalty promotions for more information on the types of loyalty promotions.

Terminologies

The table below highlights the UI/frontend terminologies and their corresponding backend terms for revoking the enrolment and issual of promotions to a customer.

UI/Frontend terminologyBackend terminologyDescription
EnrolIssueRevoke the enrolment of a customer from a promotion. The issual of the promotion for the customer must be revoked before they can be unenrolled from the promotion in an Enrol and Issue type promotion.
IssueEarnRevoke the issual of a promotion from a customer. Once revoked, the customer is ineligible to earn benefits upon meeting the defined criteria. A customer can be directly revoked from a promotion in a Direct Issue type promotion.
Enrol and IssueLOYALTY_EARNING or ISSUE_AND_EARNCustomers must first opt-in or enrol, then achieve the criteria to earn a promotion.
Direct IssueLOYALTY or DIRECT_EARNCustomers directly earn a promotion once they achieve the criteria

API endpoint example

https://eu.api.capillarytech.com/v2/promotion/bulk/revokeEnrolAndEarn

Prerequisites

  • Authentication - Basic or OAuth authentication
  • Access group resource - Write access to customer group resource
  • Loyalty programId and promotionId

Resource information

URIv2/promotion/bulk/revokeEnrolAndEarn
HTTP methodPOST
Pagination supported?NA
Rate limitNA
Batch supportYes

Body parameters

Parameter (Parameters marked as * are required)Data TypeDescription
type*EnumType of entity. Supported values:CUSTOMER
bulkAction*EnumAction to be performed.
Supported values:
REVOKE_ENROL: Unenroll customers from a loyalty promotion. This revokes the issualId of the customer. An issualIdis generated when a customer is enrolled to a loyalty promotion.
Note: When revoking an issualId, specifying the ID is not required as each customer is issued only one.

REVOKE_EARN: Revoke an earned loyalty promotion from a customer. This revokes the earnedID of the customer. An earnedIdis generated when a customer is issued a loyalty promotion.
Provide an earnedId in the earnIds parameter to revoke a specific earnedId

Refer to the Supported Actions section for the bulk actions available for each type of promotion.
promotionDetailsObjectDetails of the promotion where the action is performed.
- programId*IntegerUnique ID of the loyalty program.
- promotionId*IntegerUnique ID of the loyalty promotion. Either promotionId or promoIdentifier must be provided.
- promoIdentifier*StringUnique external identifier of the promotion that is configured. Either promotionId or promoIdentifier must be provided.
- identifierNameStringThe identifier type for the customer. Supported identifiers: id (customer ID), mobile, and email.
customersObjectList of customers on whom the revoke action will be performed.
You can add a maximum of 100 customers at once.
- identifierValue*StringIdentifier value for the identifier type defined in identifierName.
Note: The identifier values must be of the same type defined in identifierName. For example, if the identifierName is id, all the identifierValues provided must be customer IDs.
- source\StringThe source of the customer's registration.
Supported values: FACEBOOK, WEB_ENGAGE, INSTORE, MARTJACK, TMALL, TAOBAO, JD, ECOMMERCE, WEBSITE, LINE, ALL.
- earnIdsArrayList of earned IDs to revoke for a customer. An earnedId is generated when a customer is issued a loyalty promotion.

List the IDs in the following format [ID1, ID2, ID3].

If the earnIds parameter is not passed, all the earned IDs for a customer will be revoked.
{
    "type": "CUSTOMER",
    "bulkAction": "REVOKE_ENROL",
    "promotionDetails": {
        "programId": 2714,
        "promotionId": "202779"
       // "promoIdentifier": "95c77d88-470c-4dd3-bde4-606ae1b64277"
    },
    "identifierName": "id",
    "customers": [
        {
            "identifierValue": "423927867",
            "source": "instore"
        }
    ]
}
{
    "type": "CUSTOMER",
    "bulkAction": "REVOKE_ENROL",
    "promotionDetails": {
        "programId": 2714,
        "promotionId": "202779"
       // "promoIdentifier": "95c77d88-470c-4dd3-bde4-606ae1b64277"
    },
    "identifierName": "id",
    "customers": [
        {
            "identifierValue": "423927867",
            "source": "instore"
        },
        {
            "identifierValue": "423927868",
            "source": "instore"
        }
    ]
}
{
    "type": "CUSTOMER",
    "bulkAction": "REVOKE_EARN",
    "promotionDetails": {
        "programId": 2714,
        //"promotionId": "202779"
        "promoIdentifier": "95c77d88-470c-4dd3-bde4-606ae1b64277"
    },
    "identifierName": "id",
    "customers": [
        {
            "identifierValue": "423927867",
            "source": "instore"
        }
    ]
}
{
    "type": "CUSTOMER",
    "bulkAction": "REVOKE_EARN",
    "promotionDetails": {
        "programId": 2714,
        "promoIdentifier": "1d9e540d-ae2c-443f-9d0d-7ac146bf93f2"
    },
    "identifierName": "id",
    "customers": [
        {
            "identifierValue": "423927848",
            "source": "instore",
            "earnIds": [
                959
            ]
        },
        {
            "identifierValue": "423927855",
            "source": "instore",
            "earnIds": [
                960,
                963
            ]
        },
        {
            "identifierValue": "423927856",
            "source": "instore"
        }
    ]
}

Supported Action for the Promotion Type

The table below highlights the supported bulkAction for each type of promotion.

Promotion TypeSupported Bulk ActionExample
Enrol and IssueREVOKE_ENROL andREVOKE_EARNA customer is enrolled in a promotion after a ₹5000 purchase that offers a discount coupon for reviewing the product. After reviewing the product, they earn a discount coupon. If the customer returns the product, the promotion is revoked.
Direct IssueREVOKE_EARNA customer is directly issued a promotion for a 10% discount after completing a purchase. If the customer returns the product, the promotion is revoked.

Response parameters

ParameterData TypeDescription
responseArrayList of response objects.
resultObjectContains the details for a customer.
entityTypeStringType of entity. Supported entity CUSTOMER
entityIdIntegerUnique identifier of the entity.
promotionIdIntegerUnique ID of the loyalty promotion .
promoIdentifierStringUnique external identifier of the loyalty promotion that is configured.
programIdIntegerID of the loyalty program associated with the promotion.
revokedIssualIdIntegerIssue ID that is revoked from the customer.
revokedEarnIdsArrayList of Earn IDs that are revoked from the customer.
errorsArrayList of errors encountered, if any.
warningsArrayList of warnings encountered, if any.
totalCountIntegerTotal count of successful responses.
failureCountIntegerCount of failed responses.
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423926199,
                "promotionId": 202188,
                "programId": 2714,
                "issualId": "847"
            },
            "errors": [],
            "warnings": []
        },
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423926198,
                "promotionId": 202188,
                "programId": 2714,
                "issualId": "848"
            },
            "errors": [],
            "warnings": []
        },
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423926200,
                "promotionId": 202188,
                "programId": 2714,
                "issualId": "849"
            },
            "errors": [],
            "warnings": []
        },
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423926201,
                "promotionId": 202188,
                "programId": 2714,
                "issualId": "850"
            },
            "errors": [],
            "warnings": []
        }
    ],
    "totalCount": 4,
    "failureCount": 0
}
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423927867,
                "promoIdentifier": "95c77d88-470c-4dd3-bde4-606ae1b64277",
                "programId": 2714,
                "revokedEarnIds": [
                    974
                ]
            },
            "errors": [],
            "warnings": []
        },
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423927868,
                "promoIdentifier": "95c77d88-470c-4dd3-bde4-606ae1b64277",
                "programId": 2714,
                "revokedEarnIds": [
                    975,
                    977
                ]
            },
            "errors": [],
            "warnings": []
        }
    ],
    "totalCount": 2,
    "failureCount": 0
}
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 423927848,
                "promoIdentifier": "1d9e540d-ae2c-443f-9d0d-7ac146bf93f2",
                "programId": 2714,
                "revokedEarnIds": [
                    957
                ]
            },
            "errors": [],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 0
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "message": "revoke bulk action passed not supported for loyalty/generic promotion type",
                    "code": 8902
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "result": {
                "entityType": "CUSTOMER",
                "entityId": 555567088,
                "promotionId": 74230,
                "programId": 753,
                "revokedEarnIds": [
                    111
                ]
            },
            "errors": [],
            "warnings": []
        },
        {
            "errors": [
                {
                    "status": false,
                    "message": "Customer not found for the given identifiers",
                    "code": 8015
                }
            ],
            "warnings": []
        },
        {
            "errors": [
                {
                    "status": false,
                    "message": "Customer not found for the given identifiers",
                    "code": 8015
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 3,
    "failureCount": 2
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "message": "invalid programId passed",
                    "code": 1101
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "message": "promotion is inactive",
                    "code": 8892
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "code": 8874,
                    "message": "promotion id passed is invalid"
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "message": "Error occurred while issuing promotion to the customer",
                    "code": 8896
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}
{
    "response": [
        {
            "errors": [
                {
                    "status": false,
                    "message": "invalid entity type passed",
                    "code": 8901
                }
            ],
            "warnings": []
        }
    ],
    "totalCount": 1,
    "failureCount": 1
}

Error codes

Error CodeDescriptionReason
8892Promotion is inactivePromotion is currently inactive.
8015Customer not found for the given identifiersCustomer is not part of the loyalty program or the customer ID is invalid.
1101Invalid programId passedProgram ID is invalid.
8874Promotion ID passed is invalidPromotion ID is invalid.
8899Cannot enrol/issue to the user group.A user group cannot be enrolled to a promotion.
8902Revoke bulk action passed not supported for loyalty/generic promotion typeRevoking an issual for a customer in a direct earn promotion is not supported.
8881Insufficient parameters passed; program ID and one of the promotion ID/identifiers are requiredRequired parameters are not passed.
8903Earn IDs passed are either invalid or already revokedThe earned ID that is being revoked is already revoked or is invalid.
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!