Public API get methods
This will cover all the retrieving data Javascript methods of the joyInstance object. These methods will request our Public API and get the data to your client side.
Customer
Getting customer info via Joy API. This will get the customer info of the currently logged-in user on the store.
joyInstance.customer().then(function(resp){
console.log(resp)
});Sample response:
{
"id": "avsu0TQoHYd4Zq5TZ123",
"shopifyCustomerId": 123123123,
"earnSignUp": true,
"name": "admin super",
"hasPoint": true,
"state": "enabled",
"shopId": "7vqeDbhZtyofeuH7l123",
"type": "member",
"acceptsMarketing": false,
"urlReferral": "https://inviteee.to/i/1234",
"email": "[email protected]",
"createdAt": "2023-04-04T07:03:32.119Z",
"totalSpent": 22,
"latestActivity": "2023-06-14T04:45:55.465Z",
"point": 100,
"updatedAt": "2023-08-08T04:10:06.186Z",
"appliedCollectionIds": []
}Shop
This method will get the shop data from Joy's public API and return a Promise resolving the shop data.
Sample response:
Translations
This method will get the translation dictionary data from our app via Public API.
Sample response:
Redeeming programs
This method will get the list of redeeming programs from the public API.
Sample response:
Earning programs
This method will get the list of earning programs from the public API.
Sample response:
Customer activities
This method will get a list of customer activity history. This will paginate by before and after parameters.
Sample response:
Coupon list
This method will get a list of customer coupons that they redeemed. This will paginate by before and after parameters.
Sample response:
Tiers
This method will get a list of all VIP tiers available in your programs.
Sample response:
Branding
This method will get the branding setting of the floating widget:
Sample response:
Point calculators
We have two methods that act as two API endpoints to get the number of points for a customer can get for one product, or a cart.
This API endpoint will return data like this:
Product calculator
You need to pass the variantId and the productId. The customerId will be automatically retrieved.
Here is the direct API implementation:
Cart calculator
If this method takes autoFetchCart true, it will call to /cart.js AJAX API itself. If you have the items because you called the API beforehand, you can pass them manually via the items parameter.
Here is the API version:
Last updated