서버 측 구매 소비에 사용되는 consumePurchase API의 세부 사항입니다.
구매를 인증한 후에는 소비됨으로 표시해야 합니다.
구매 소비에는 다음이 포함됩니다.
https://payments-api.now.gg/
v2/order/consumePurchase
POST
'Authorization': '<payment_api_key_here>', 'Content-Type': 'application/x-www-form-urlencoded'
consumePurchase API와 함께 요청 본문에 다음 매개변수를 포함해야 합니다:
"purchaseToken": "<purchase_token_here>", "productId": "<product_id_here>", // 더 이상 사용되지 않음 "developerPayload": "developerPayload", // 선택 "type": "<store>" // 더 이상 사용되지 않음
productId와 type 필드는 더 이상 사용되지 않습니다.다음 샘플 코드는 consumePurchase API를 통한 관련 요청 방법을 보여드립니다.
import requests
url = "https://payments-api.now.gg/v2/order/consumePurchase"
headers = {
"Authorization": "<payment_api_key_here>",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"purchaseToken": "<purchase_token_here>",
"developerPayload": "developerPayload" // 선택
}
response = requests.post(url, headers=headers, data=data)
print("응답 상태 코드:", response.status_code)
print("응답 본문:", response.text)
curl --location --request POST 'https://payments-api.now.gg/v2/order/consumePurchase' \
--header 'Authorization: <payment_api_key_here>' \
--header 'Content-Type': 'application/x-www-form-urlencoded' \
--data '{
"purchaseToken": "<purchase_token_here>",
"developerPayload" : "developerPayload" // 선택 사항
}'
Payments API Key는 nowStudio의 자격 증명에 있습니다. (자세히)다음은 consumePurchase API의 샘플 응답 메시지입니다.
{
"success": true,
"code": 0,
"codeMsg": "success",
"data": {}
}
| 변수 | 형 | 설명 |
|---|---|---|
| success | boolean | 성공 여부를 true 또는 false로 반환합니다. |
| code | int | 성공하면 0을 반환하고 실패하면 0이 아닌 값을 반환합니다. |
| codeMsg | string | 오류 코드와 관련된 메시지를 반환합니다. |
| data | object | 응답 메시지로 반환된 데이터입니다. |
| 코드 | 메시지 | 설명 |
|---|---|---|
| 3800 | ERROR_CONSUMING_PRODUCT | 제품을 소비하는 중에 오류가 발생했습니다. |
| 3900 | INVALID_AUTHORIZATION_KEY | 승인을 위해 제공된 API 키가 잘못되었습니다. |
| 3901 | INVALID_PURCHASE_TOKEN | 제공된 구매 토큰이 잘못되었습니다. |
| 5014 | MULTISTORE_UNKNOWN_ERROR | Multistore API에서 발생한 일반적인 오류를 나타냅니다. |
| 5015 | MULTISTORE_AUTH_ERROR | Multistore API의 인증/자격 증명 생성 중 발생한 오류를 나타냅니다. |
목차
목차
문서 Rev. 1.0