구매 한도 설정
고객 그룹의 주간·월간 구매 한도를 설정합니다.
API 엔드포인트
이 scope 는 Bootpay-Role 헤더와 상관없이 검사합니다. v1 회원 그룹 API 상세 명세에서 인증과 응답 필드를 확인합니다.
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| id | String | Y | 그룹 고유 ID (URL 파라미터) |
| use_limit | Boolean | N | 구매 한도 기능 사용 여부. JSON boolean 으로 보냅니다. 문자열 "false" 는 켠 것으로 검증됩니다 |
| limit_month_purchase | Number | N | 월 구매 한도 금액 (단위: 원) |
| limit_message | String | N | 한도 초과 시 노출할 안내 문구 |
| limit_week_purchase | Number | N | 주 구매 한도 금액 (단위: 원) |
코드 예제
curl -X PUT "https://api.bootapi.com/v1/user-groups/67e2052b03d0cb4e4117b0af/limit" \
-H "Authorization: Basic {base64(client_key:secret_key)}" \
-H "Bootpay-Role: manager" \
-H "Content-Type: application/json" \
-d '{
"use_limit": true,
"limit_month_purchase": 3500000,
"limit_week_purchase": 1000000
}'import { BootpayCommerce } from '@bootpay/backend-js';
const commerce = new BootpayCommerce({
client_key: '{client_key}',
secret_key: '{secret_key}'
});
const userGroupId = '67e2052b03d0cb4e4117b0af';
const response = await commerce.userGroup.limit({
user_group_id: userGroupId,
use_limit: true,
limit_month_purchase: 3500000,
limit_week_purchase: 1000000
});
console.log(response);from bootpay_backend.commerce import BootpayCommerce
commerce = BootpayCommerce('{client_key}', '{secret_key}')
user_group_id = '67e2052b03d0cb4e4117b0af'
response = commerce.user_group.limit({
'user_group_id': user_group_id,
'use_limit': True,
'limit_month_purchase': 3500000,
'limit_week_purchase': 1000000
})
print(response)use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
$userGroupId = '67e2052b03d0cb4e4117b0af';
$response = $commerce->userGroup->limit([
'user_group_id' => $userGroupId,
'use_limit' => true,
'limit_month_purchase' => 3500000,
'limit_week_purchase' => 1000000
]);
print_r($response);import kr.co.bootpay.store.BootpayStore;
import kr.co.bootpay.store.model.request.TokenPayload;
import kr.co.bootpay.store.model.request.userGroup.UserGroupLimitParams;
TokenPayload tokenPayload = new TokenPayload("{client_key}", "{secret_key}");
BootpayStore bootpay = new BootpayStore(tokenPayload).withToken();
UserGroupLimitParams params = new UserGroupLimitParams();
params.userGroupId = "67e2052b03d0cb4e4117b0af";
params.useLimit = true;
params.limitMonthPurchase = 3500000.0;
params.limitWeekPurchase = 1000000.0;
var response = bootpay.userGroup.limit(params);
System.out.println(response.getData());require 'bootpay'
commerce = BootpayStore::RestClient.new(client_key: '{client_key}', secret_key: '{secret_key}')
user_group_id = '67e2052b03d0cb4e4117b0af'
response = commerce.user_group_limit(
user_group_id: user_group_id,
use_limit: true,
limit_month_purchase: 3500000,
limit_week_purchase: 1000000
)
puts response.datacommerce := bootpay.NewCommerceAPI("{client_key}", "{secret_key}", nil, "production")
userGroupId := "67e2052b03d0cb4e4117b0af"
monthLimit, weekLimit := 3500000, 1000000
response, err := commerce.UserGroup.Limit(bootpay.UserGroupLimitParams{
UserGroupId: userGroupId,
UseLimit: true,
LimitMonthPurchase: &monthLimit,
LimitWeekPurchase: &weekLimit,
})
fmt.Println(response, err)using Bootpay.Commerce;
using Bootpay.Commerce.Models;
var commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
var userGroupId = "67e2052b03d0cb4e4117b0af";
var response = await commerce.UserGroupLimit(new UserGroupLimitParams {
UserGroupId = userGroupId,
UseLimit = true,
LimitMonthPurchase = 3500000,
LimitWeekPurchase = 1000000
});
Console.WriteLine(await response.Content.ReadAsStringAsync());응답
성공 응답
JSON
{
"use_limit": true,
"limit_month_purchase": 3500000,
"limit_week_purchase": 1000000,
"subscribed_month_limit": 1200000,
"subscribed_week_limit": 300000,
"limit_message": "한도를 초과했습니다."
}에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
USER_GROUP_NOT_FOUND | 회원 그룹 정보를 찾지 못했습니다. 다시 로그인 해주세요. | user_group_id를 확인합니다 |
USER_GROUP_NOT_AUTHORIZED | 그룹 정보를 설정할 권한이 없습니다. (HTTP 401) | 이 프로젝트의 그룹인지 확인합니다 |
USER_GROUP_PURCHASE_LIMIT_REQUIRED | 월 구매 한도 금액 값을 입력해주세요. | use_limit: true 면 limit_month_purchase·limit_week_purchase 를 0보다 크게 넣습니다 |
USER_GROUP_PURCHASE_LIMIT_BELOW_SUBSCRIBED | 월 구매 한도 금액이 현재 구독된 금액보다 적습니다. | 현재 구독 금액 이상으로 설정합니다 |