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

ParameterColumn TypeDescriptionExample
id *RequiredStringCustomer ID
顧客ID
id=5e0047dfc4101900263b1450
value
*Required
IntegerPoints to be added or deducted
增加或減除點數

  • Number can be -999999~999999
"value":100
remarks
*Required
StringReason for adding or deducting member points
增加或減除點數原因

  • Limit to max 50 characters
"remarks":"add 100 member points"
"remarks":"週年慶贈送 100會員點數"
email_targetintegerNotification with Email
是否發送email通知
Only applicable for adding points
僅適用於增加 member points
1=NOT_SEND全部不送
3=SEND_TO_ALL全部都送
sms_notification_targetintegerNotification with SMS
是否發送簡訊通知
Only applicable for adding points
僅適用於增加 member points
1=NOT_SEND全部不送
2=SEND_VERIFIED只送手機驗證過的
3=SEND_TO_ALL全部都送
  • 如果沒指定,default 是 3=SEND_TO_ALL全部都送
expire_datedate

Expiry date of points.

會員點數到期日

Only available when feature member_points_expiry_enhancement is enabled.
  • date string: expires at end of day in merchant timezone (23:59:59.999)
  • null: never expires
  • omitted: expiry calculated from global earn_from_order rule
日期格式 (YYYY-MM-DD),如 2026-03-19

Response Fields

FieldColumn TypeDescritptionExample
customer_idStringCustomer ID
顧客ID
5e0047dfc4101900263b1450
point_balancIntegerCurrent Customer's Member Points
顧客現有會員點數
200
remarksStringReason for adding or deducting credits
增加或減除點數原因
add 100 member points
valueIntegerPoints to be added or deducted
增加或減除點數
100
end_atDatetimeExpiry date, a null value means never expired
到期日期, null 表示不會到期
  • 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

ContentDescription
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.

Did this page help you?