HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update Customer Member Points

Function

Using open API to update customer member points

URL

POST <<api_domain>>/v1/customers/:id/member_points

Request Parameters

ParameterColumn TypeDescriptionExample
id
*Required
StringCustomer ID
顧客ID
ruby id=5e0047dfc4101900263b1450
value
*Required
IntegerPoints to be added or deducted
增加或減除點數
-
*Number can be -999999~999999
ruby "value":39
remarks
*Required
StringReason for adding or deducting member points
增加或減除點數原因
-
*Limit to max 50 characters
ruby "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全部都送

Response Fields

FieldColumn TypeDescritptionExample
customer_idStringCustomer ID
顧客ID
5e0047dfc4101900263b1450
point_balancIntegerCurrent Customer's Member Points
顧客現有會員點數
139
remarksStringReason for adding or deducting credits
增加或減除點數原因
add 100 member points
valueIntegerPoints to be added or deducted
增加或減除點數
39
end_atDatetimeExpiry 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 '{
	"value": 39,
	"remarks": "add 100 member points",
}'

Response Example

Also same with Get Order

{
    "customer_id": "5e0047dfc4101900263b1450",
    "point_balance": 139,
    "remarks": "add 100 member points",
    "value": 39,
    "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.