Custom Point Earning Rules in Member System
You can now create custom point rules in the Member System to reward customers with points based on specific actions. This guide walks you through the complete process: from creating a private app to issuing points via the Storefront API, so you can build personalized member reward experiences.
To learn more about other point rule configuration features, please refer to this article: Setting Up and Managing Your Member Points Program.
| Note: Custom point rules are available only on the Pro and Custom plans. |
Creating a Custom Point Rule
- Go to Member System > Points > Points Rules > Add rules.
- Click Custom points rule and define your earning logic.
3. After saving, the system will generate a Rule ID, which is required when calling the custom point issuance API.
Within each custom rule, you can also configure the Points Issuance Timing, which determines how and when points are granted to customers:
-
Issue points immediately upon button click
- If you select this option, points will be granted automatically when customers click the rule’s action button in the Member Panel, Member Center, or Member Landing Page.
- No additional code development is required.
-
Issue points after completing a specified action
- If you select this option, the system will generate a code snippet that contains the Rule ID. This code snippet is used together with the customRulesPointGrant API (Coming Soon).
- The code snippet notifies your system that a customer has clicked the rule’s action button in the Member Panel, Member Center, or Member Landing Page. You are responsible for determining whether the customer has completed the specified action (for example, completing a task or external workflow). Once the condition is met, you can call the customRulesPointGrant API (Coming Soon)to issue points.
- The customRulesPointGrant API (Coming Soon) enforces the issuance limits defined in the rule configuration. If a customer exceeds the allowed number of point grants, additional API calls will not result in points being issued.
Triggering Custom Point Issuance
Custom point issuance requires a private app and proper API permissions.
Step 1: Create a Private App
-
Go to SHOPLINE Admin > Apps > Develop Apps > Create an App.
- Fill in the app information (e.g., Custom Point Rule Issuance) and click Create.
- After creation, click Edit to manage the app.
| Note: Ensure your account has Develop Apps permission. |
Step 2: Configure API Permissions
- In the app editor, go to Permission configuration > Integrate Storefront API > Configuration.
- Enable the following:
-
Customers: Allow creating Customer Access Token to identify users.
-
Customers: Allow creating Customer Access Token to identify users.
- Click Save.
Step 3: Obtain Storefront Access Token
- Switch to API certificate > Access Token > Install App.
-
Copy the generated Storefront Access Token. Keep it secure as it authenticates all API requests.
| Note: The Storefront Access Token is the identity credential of your app. Please keep it secure and do not share it with others. |
Creating a Customer Access Token
Before issuing points, customer identity must be verified. You can obtain a Customer Access Token using the following documentation:
- customer-access-token-create
- customer-access-token-create-with-social-login
- customer-activate-by-verification
- customer-access-token-create-with-multipass
| Tip: Execute this logic in your backend to prevent token leaks. |
API Call Example (Node.js)
Below is an example of using Node.js to call customRulesPointGrant to issue custom points. You may use any programming language as needed.
| Security Tip: It is recommended to execute this logic on the backend to prevent token leakage. |
const STORE_DOMAIN = 'your-store-domain.myshopline.com';
const STORE_FRONT_TOKEN = 'your-storefront-token'
const STORE_FRONT_VERSION = 'v20251201'
const CUSTOMER_ACCESS_TOKEN = '#A01#SID0xxxxxxxxxxxxxxxxxxxxxxxxxxx';
const EARN_ID = 'BACxxxxxxxxxxxxxxxxxxxx';
const graphqlMutation = `
mutation customRulesPointGrant($customerAccessToken: String!, $earnId: String!) {
customRulesPointGrant(customerAccessToken: $customerAccessToken, earnId: $earnId) {
memberUserErrors { code }
}
}
`;
fetch(`https://${STORE_DOMAIN}/storefront/graph/${STORE_FRONT_VERSION}/graphql.json`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${STORE_FRONT_TOKEN}`
},
body: JSON.stringify({
query: graphqlMutation,
variables: {
customerAccessToken: CUSTOMER_ACCESS_TOKEN,
earnId: EARN_ID
}
})
})
If the API is called successfully and returns no errors, the customer will receive the issued points.
Implementation Methods
Method 1: Custom Theme Code
- Add interactive elements such as trigger buttons to your theme page.
- Bind click events to call the customRulesPointGrant API (Coming Soon).
Method 2: Member System Event Listener (Themes 3.0 and Above)
- Listen for the membersystem:custom-point-earn event.
- Call customRulesPointGrant (Coming Soon) within the event callback.
window.themeEventCenter.addListener('membersystem:custom-point-earn', function(event) {
const { earnId } = event.detail;
// Call Storefront API to issue points
});