Update Customer Member Points
Function
Using open API to update customer member points
URL
POST <<api_domain>>/v1/customers/:id/member_points
若要使用此 API ,請確認店家是否已經開啟會員點數總開關以及設定點數規則
Please make sure the "Member Points Toggle" has been set to "ON" and the point-earning rules has been set up before using this API.
Request Parameters
Parameter | Column Type | Description | Example |
---|---|---|---|
id *Required | String | Customer ID 顧客ID | id=5e0047dfc4101900263b1450 |
value *Required | Integer | Points to be added or deducted 增加或減除點數 - *Number can be -999999~999999 | "value":100 |
remarks *Required | String | Reason for adding or deducting member points 增加或減除點數原因 - *Limit to max 50 characters | "remarks":"add 100 member points" "remarks":"週年慶贈送 100會員點數" |
email_target | integer | Notification with Email 是否發送email通知 Only applicable for adding points 僅適用於增加 member points | 1=NOT_SEND全部不送 3=SEND_TO_ALL全部都送 |
sms_notification_target | integer | Notification with SMS 是否發送簡訊通知 Only applicable for adding points 僅適用於增加 member points | 1=NOT_SEND全部不送 2=SEND_VERIFIED只送手機驗證過的 3=SEND_TO_ALL全部都送 - 如果沒指定,default 是 3=SEND_TO_ALL全部都送 |
Response Fields
Field | Column Type | Descritption | Example |
---|---|---|---|
customer_id | String | Customer ID 顧客ID | 5e0047dfc4101900263b1450 |
point_balanc | Integer | Current Customer's Member Points 顧客現有會員點數 | 200 |
remarks | String | Reason for adding or deducting credits 增加或減除點數原因 | add 100 member points |
value | Integer | Points to be added or deducted 增加或減除點數 | 100 |
end_at | Datetime | Expiry Date of added/deducted points 增減之會員點數到期日 *Expiry date follows the member points rule settings. | 2021-09-14T16:00:00.000+00:00 |
Request Example
Create a Customer.
curl -X POST \
https://oapi.shoplinestg.com/v1/customers/:id/store_credits \
-H 'Accept: application/json' \
-H 'Authorization: Bearar access_token' \
-H 'Content-Type: application/json' \
-d '{
"id": "5e0047dfc4101900263b1450",
"value": 100,
"remarks": "add 100 member points",
}'
Response Example
Also same with Get Order
{
"customer_id": "5e0047dfc4101900263b1450",
"point_balance": 200,
"remarks": "add 100 member points",
"value": 100,
"end_at": "2021-09-14T16:00:00.000+00:00"
}
Error Message
Content | Description |
---|---|
ruby "error": "value is invalid" | Response with this message in following situations: 1.value is not an integer 2.value is out of the valid range |
ruby "error": "value cannot be 0" | Response with this message when value is 0 |
ruby "error": "value is required" | Response with this message when value is not available *Note: Will show this message along with "value is invalid" |
ruby "error": "remarks is limited to a maximum of 50 characters" | If you send a remarks with more than 50 characters |
ruby "error": "remark is empty" | If you send a remark with empty value |
ruby "error": "remarks is required" | If you doesn't send remarks value or field *Note: Will show this message along with "remarks is empty" |
ruby "error": "not allowed to update_member_points? this Customer" | If the token you use has no authority to add/deduct points. |
ruby "error": "Member points feature not enabled" | If you don't have member points function |
ruby "error": "Please setup the member points rule in admin panel first" | If you haven't setup the member points rules. |
Updated 9 months ago