주요 콘텐츠로 건너뛰기

Coupon Redeemed Webhook

Aghanim offers a coupon redeemed webhook to notify your game when a redeem code for a free item has been used by a player, providing detailed information about the event.

This webhook is activated through the Coupon redeemed event, selectable in Game → Webhooks.

경고

To credit in-game items to player accounts, use the item.add webhook. The coupon redeemed webhook is designed to provide detailed data when item.add is insufficient.

Redeem coupon webhook image
Redeem coupon webhook image

Requirements

To use the redeemed coupon webhook from Aghanim, you should have the webhook server configured as follows:

  • HTTPS endpoint, accepting POST webhook requests.
  • Listen for events, generated and signed by Aghanim.
  • Respond with 2xx status codes to signal successful processing, and 4xx or 5xx for denial or errors.

Configuration

  1. Develop a function for the coupon.redeemed webhook processing.
  2. Make your endpoint available.
  3. Register your endpoint within Aghanim account → GameWebhooksNew Webhook by choosing the corresponding event type.

Alternatively, you can register your endpoint within Aghanim using the Create Webhook API method.

Request schema

아래는 예시입니다 coupon.redeemed 웹훅 요청:

POST /your/webhook/uri HTTP/1.1
Content-Type: application/json
Host: your-webhook-endpoint.com
User-Agent: Aghanim/0.1.0
X-Aghanim-Signature: 2e45ed4dede5e09506717490655d2f78e96d4261040ef48cc623a780bda38812
X-Aghanim-Signature-Timestamp: 1725548450

{
"event_type": "coupon.redeemed",
"event_data": {
"player_id": "2D2R-OP3C",
"coupon": {
"code": "WELCOME",
"sku": "crystals",
"redeemed_at": 1725548450
},
"item": {
"id": "itm_exTBZQmIlDz",
"name": "Crystals",
"description": "Reign supreme over your rivals with this massive crystal treasure.",
"sku": "crystals",
"quantity": 480000,
"price": 9499,
"price_decimal": 94.99,
"currency": "USD",
"type": "item",
"nested_items": null
}
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": "idmpt_aXRlb...JkX2VFS",
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.redeem",
"transaction_id": "whtx_eCacGbJVbvT",
"context": null,
"game_id": "gm_exTAyxPsVwh"
}

이벤트 스키마

Key유형설명
event_idstringAghanim에 의해 생성된 고유 이벤트 ID.
game_idstringAghanim 시스템에서의 귀하의 게임 ID.
event_typestring이벤트의 유형, coupon.redeemed 이럴 경우.
event_timenumber유닉스 에포크 시간으로 된 이벤트 날짜.
event_dataEventData이벤트 특정 데이터가 포함되어 있으며, 상속된 객체에 대한 가능한 키가 포함됩니다.
idempotency_keystring웹훅 작업이 재시도되어도 한 번만 실행되도록 보장합니다.
request_idstring|null이벤트가 API 요청에 의해 트리거된 경우, 요청 ID가 포함됩니다.
sandboxboolean이 이벤트가 샌드박스 게임 환경에서 전송되었는지를 표시합니다.
triggerstring|nullThe trigger that caused the event to be sent.
transaction_idstringAghanim이 생성한 거래 ID입니다. 이 ID는 동일한 거래 내에서 발생한 여러 이벤트에서 동일할 수 있습니다.
contextEventContext|null이벤트에 대한 컨텍스트 정보.

EventContext 스키마

Key유형설명
orderOrderContext|null해당되는 경우 이벤트와 관련된 주문 정보입니다.
playerPlayerContext|null플레이어 정보를 추가하려면 웹훅 설정에서 "플레이어 컨텍스트 추가"를 활성화하세요.

The EventData schema

KeyTypeDescription
player_idstringThe unique Player ID chosen for player authentication.
couponCouponThe coupon object containing the redeem code data.
itemItemThe item object containing details about the free item provided upon redeeming the code.

The Coupon object

KeyTypeDescription
codestringRedeem code.
skustringFree item SKU provided upon the redeem code usage.
redeemed_atnumberCode usage date in Unix epoch time.

The Trigger values

ValueDescription
hub.redeemWhen a coupon for a free item is redeemed.
testWhen using the "Send test event" in the Dashboard.

아이템 스키마

KeyType설명
idstringAghanim에 의해 생성된 아이템 ID.
namestring아이템 이름.
descriptionstring|null아이템 설명.
skustring게임과 Aghanim 측 모두에서 일치하는 아이템 SKU.
quantitynumber아이템 수량.
typestring항목 유형. 가능한 값: item, bundle.
nested_itemsNestedItem[]|null번들에 포함된 항목 배열.
fallback_itemItem|null주 아이템을 플레이어에게 제공할 수 없을 경우 백업으로 제공할 수 있는 아이템입니다.

항목 유형 bundle 내부에 여러 중첩된 항목을 포함할 수 있습니다.
번들의 공통 SKU를 처리하거나 각 중첩 항목을 개별적으로 처리할 수 있습니다.

NestedItem 스키마

Key유형설명
idstringAghanim에 의해 생성된 아이템 ID.
namestring아이템 이름.
descriptionstring|null아이템 설명.
skustring게임과 Aghanim 측 모두에서 일치하는 아이템 SKU.
quantitynumber아이템 수량.
typestring항목 유형. 가능한 값: item, bundle.
nested_itemsNestedItem[]|null번들에 포함된 항목 배열.

도움이 필요하세요?
통합팀에 문의하십시오 integration@aghanim.com