Public API action methods

This will cover all the posting data Javascript methods of the joyInstance object. These methods will take action on behalf of the current user such as: redeeming points, and getting referral links.

Redeem a program

This method will call an API request to redeem the customer balance for a coupon. This will take 2 params programId and points (optional). With a program like: "Get 10% off for 100 points" then it would not need the point parameter. For dynamic redeeming programs, it will need the amount of points that customers want to redeem.

joyInstance.redeem(programId, points).then(function(resp){
    console.log(resp)
});

Sample response:

{
    "customer": {
        "id": "avsu0TQoHYd4Zq5TZnJg",
        "shopifyCustomerId": 6858989109535,
        "earnSignUp": true,
        "name": "admin super",
        "hasPoint": true,
        "state": "enabled",
        "shopId": "7vqeDbhZtyofeuH7l1ky",
        "type": "member",
        "acceptsMarketing": false,
        "urlReferral": "https://inviteee.to/i/5Nuw",
        "email": "anhth@avada.email",
        "createdAt": "2023-04-04T07:03:32.119Z",
        "totalSpent": 22,
        "latestActivity": "2023-06-14T04:45:55.465Z",
        "point": 9999800,
        "updatedAt": "2023-08-08T06:48:42.938Z",
        "appliedCollectionIds": []
    },
    "discount": {
        "id": "gid://shopify/DiscountCodeNode/1396689076511",
        "code": "JOY-1YOCADBV6JMW"
    }
}

This method will generate the referral link for the customer by their email. This will only create a new link if the customer matching the email has not created one. If not, it will return the existing referral link.

joyInstance.generateLinkReferral(email).then(function(resp){
    console.log(resp)
});

Sample response:

{
    "url":"https://inviteee.to/i/a8h3"
}

Update date of birth

Our app stores customer birthdays in the format: DD/MM. You can update that on behalf of the logged-in user.

joyInstance.updateDOB(month, day).then(function(resp){
    console.log(resp)
});

Sample response:

{status: true}

Last updated