HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update Customer Store Credits

Function

To update customer store credits with open API
使用 open API 更新顧客購物金

URL

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

Request Parameters

ParameterValueDescriptionExample
id
*Required
StringCustomer ID
顧客ID
ruby id=58d3440869702d39b7060000
value
*Required
IntegerCredits to be added or deducted
增加或減除金額
-
*Number can be -999999~999999
ruby "value":100
remarks
*Required
StringReason for adding or deducting credits
增加或減除購物金原因
-
* Limit to max 50 characters
ruby "remarks":"add 100 store credits" "remarks":"週年慶贈送 100紅利"
expires_atDateValidity Period
有效期限
-
Date cannot be in the past.
Date should be within 9999 days from now.

null means Never expires
ruby "expires_at": "2021-11-30"
email_targetIntegerNotification with Email
是否發送email通知
-
1=NOT_SEND全部不送
3=SEND_TO_ALL全部都送
ruby "email_target":1
sms_notification_targetIntegerNotification with SMS
是否發送簡訊通知
-
1=NOT_SEND全部不送
2=SEND_VERIFIED只送手機驗證過的
* 3=SEND_TO_ALL全部都送
ruby "sms_notification_target":1

Response fields

FieldColumn TypeDescritptionExample
customer_idStringCustomer unique ID.
顧客ID
58d3440869702d39b7060000
credit_balanceIntegerCurrent Customer Credit
顧客現有購物金
500
remarksStringReason for adding or deducting credits
增加或減除購物金原因
add 100 store credits
valueIntegerCredits to be added or deducted
增加或減除金額
100
end_atDatetimeValidity Period
有效期限
2021-11-30T00: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": 100,
	"remarks": "add 100 store credits",
	"expires_at": "2021-11-30"
}'

Response Example

{
    "customer_id": "58d3440869702d39b7060000",
    "credit_balance": 500,
    "remarks": "add 100 store credits",
    "value": 100,
    "end_at": "2021-11-30T00:00:00.000+00:00"
}