Earning programs
Get all earning programs available to all or specific customers
Last updated
Get all earning programs available to all or specific customers
Last updated
Retrieve an earning program by its ID.
OK
const response = await fetch('https://dev-api.joy.so/rest_api/v1/earning/{programId}', {
method: 'GET',
headers: {},
});
const data = await response.json();
{
"success": false,
"program": {
"id": "text",
"limitUnit": "text",
"includeProducts": [],
"autoRemovePoints": false,
"earnBy": "text",
"type": "text",
"title": "text",
"productPointsCalculator": {
"color": "text",
"type": "text",
"font": "text"
},
"hasLimit": false,
"typeProductMatch": "text",
"typeCondition": "text",
"statusProductPointsCalculator": false,
"shopId": "text",
"event": "text",
"conditions": [
{
"field": "text",
"typeMatch": "text",
"content": "text"
}
],
"enableCardPage": false,
"excludeProducts": [],
"statusUseCondition": false,
"status": false,
"createdAt": "2024-10-03T13:29:59.075Z",
"updatedAt": "2024-10-03T13:29:59.075Z",
"appliedCollectionIds": []
}
}
OK
const response = await fetch('https://dev-api.joy.so/rest_api/v1/earning-programs-by-customer', {
method: 'GET',
headers: {},
});
const data = await response.json();
{
"data": [
{
"id": "4c34m1vNgXivLXJmrEFB",
"excludePOSOrderProducts": false,
"limitUnit": "minute",
"includeProducts": [],
"rateMoney": 100,
"autoRemovePoints": true,
"earnBy": "price",
"type": "earning",
"title": "Place Order",
"excludeOSOrderProducts": false,
"priority": 0,
"hasLimit": false,
"typeProductMatch": "all",
"typeCondition": "all",
"shopId": "umN0f3GKyQC3XS1AwVWg",
"event": "place_order",
"conditions": [
{
"field": "title",
"typeMatch": "contains",
"content": ""
}
],
"limitInterval": 1,
"giftStatus": "none",
"status": true,
"excludeProducts": [
{
"image": {
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153"
},
"images": [
{
"updated_at": "2023-12-19T23:05:53-05:00",
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153",
"product_id": 8209413800171,
"admin_graphql_api_id": "gid://shopify/ProductImage/40721516593387",
"alt": "Gift card that shows text: Generated data gift card",
"width": 2881,
"created_at": "2023-12-19T23:05:53-05:00",
"variant_ids": [],
"id": 40721516593387,
"position": 1,
"height": 2881
}
],
"options": [
{
"product_id": 8209413800171,
"values": [
"$10",
"$25",
"$50",
"$100"
],
"name": "Denominations",
"id": 10444919046379,
"position": 1
}
],
"handle": "gift-card",
"id": 8209413800171,
"variants": [
{
"inventory_quantity": 0,
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153",
"price": "10",
"option3": null,
"option1": "$10",
"id": 44438017409259,
"option2": null,
"title": "$10"
}
],
"title": "Gift Card"
}
],
"statusUseCondition": true,
"changeProgramTitle": false,
"expired": false,
"isDraft": false,
"appliedPlaceOrderTo": "all",
"earnPoint": 12,
"earnPointsTiers": {
"1Fe1kqHZbE7Alx1GmFEC": {
"earnPoint": 12
}
},
"createdAt": "2023-12-20T04:16:40.318Z",
"translateTitle": "وضع الطلب",
"updatedAt": "2024-08-30T09:50:37.994Z",
"isEarned": false
}
]
}
Get a list of all earning programs.
OK
const response = await fetch('https://dev-api.joy.so/rest_api/v1/earning', {
method: 'GET',
headers: {},
});
const data = await response.json();
{
"data": [
{
"id": "4c34m1vNgXivLXJmrEFB",
"excludePOSOrderProducts": false,
"limitUnit": "minute",
"includeProducts": [],
"rateMoney": 100,
"autoRemovePoints": true,
"earnBy": "price",
"type": "earning",
"title": "Place Order",
"excludeOSOrderProducts": false,
"priority": 0,
"hasLimit": false,
"typeProductMatch": "all",
"typeCondition": "all",
"shopId": "umN0f3GKyQC3XS1AwVWg",
"event": "place_order",
"conditions": [
{
"field": "title",
"typeMatch": "contains",
"content": ""
}
],
"limitInterval": 1,
"giftStatus": "none",
"status": true,
"excludeProducts": [
{
"image": {
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153"
},
"images": [
{
"updated_at": "2023-12-19T23:05:53-05:00",
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153",
"product_id": 8209413800171,
"admin_graphql_api_id": "gid://shopify/ProductImage/40721516593387",
"alt": "Gift card that shows text: Generated data gift card",
"width": 2881,
"created_at": "2023-12-19T23:05:53-05:00",
"variant_ids": [],
"id": 40721516593387,
"position": 1,
"height": 2881
}
],
"options": [
{
"product_id": 8209413800171,
"values": [
"$10",
"$25",
"$50",
"$100"
],
"name": "Denominations",
"id": 10444919046379,
"position": 1
}
],
"handle": "gift-card",
"id": 8209413800171,
"variants": [
{
"inventory_quantity": 0,
"src": "https://cdn.shopify.com/s/files/1/0680/3950/8203/products/gift_card.png?v=1703045153",
"price": "10",
"option3": null,
"option1": "$10",
"id": 44438017409259,
"option2": null,
"title": "$10"
}
],
"title": "Gift Card"
}
],
"statusUseCondition": true,
"changeProgramTitle": false,
"expired": false,
"isDraft": false,
"appliedPlaceOrderTo": "all",
"earnPoint": 12,
"earnPointsTiers": {
"1Fe1kqHZbE7Alx1GmFEC": {
"earnPoint": 12
}
},
"createdAt": "2023-12-20T04:16:40.318Z",
"translateTitle": "وضع الطلب",
"updatedAt": "2024-08-30T09:50:37.994Z"
}
]
}
Calculate the points a user would earn for a given activity without actually awarding the points.
OK
const response = await fetch('https://dev-api.joy.so/rest_api/v1/earn/calc-points', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"products": [
{
"id": 8209413964011,
"quantity": 1,
"price": 630
}
]
}),
});
const data = await response.json();
{
"data": {
"pointsEarn": 264,
"products": [
{
"title": "The Multi-managed Snowboard",
"vendor": "Multi-managed Vendor",
"tags": [
"Premium",
"Snow",
"Snowboard",
"Sport",
"Winter"
],
"variants": {
"nodes": [
{
"id": "gid://shopify/ProductVariant/44438017671403"
}
]
},
"resourcePublicationsV2": {
"nodes": [
{
"publication": {
"name": "Online Store"
}
}
]
},
"published_scope": "web",
"id": 8209413964011,
"type": "",
"collections": [
{
"title": "Automated Collection",
"published_scope": "web"
}
]
}
]
},
"success": true
}