JavaScript SDK
Public API action methods

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's balance for a coupon.
It normally takes 2 parameters: programId and points (optional).

  • For fixed-point programs like "Get 10% off for 100 points", the points parameter is not required.
  • For dynamic redeem programs, customers must provide the number of points they want to redeem.

Additional parameter for Free Gift programs:

If the program type is Free gift and uses the option "Free one product from selection", the method supports an additional optional parameter:

  • variantIdSelected (optional) — the variant ID of the selected free gift product.
joyInstance.redeem(programId, points, variantIdSelected).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"
    }
}

Generate referral link

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}

Revoke coupon

This API will enable a coupon revocation action for coupons at your customer's end.

joyInstance.revokeCoupon(rewardId).then(function(resp){
    console.log(resp)
});

Sample response

{status: true}

Product
Install AppWebsiteBook a Demo
Developers
JavaScript SDKREST API v2Webhook API
Company
Avada GroupHelp CenterContact
© 2026 Joy Loyalty by Avada Group. All rights reserved.