> For the complete documentation index, see [llms.txt](https://develop-hotopay.potatosoft.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://develop-hotopay.potatosoft.kr/triggers.md).

# 트리거 목록

### hotopay.updatePurchaseStatus after

결제 완료 혹은 결제 취소 등 `결제 상태`가 바뀔때마다 호출됩니다.

<table><thead><tr><th width="177">변수명</th><th width="134">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>purchase_srl</code></td><td>int</td><td>결제 번호입니다. 번호 앞자리에 <code>HT</code>를 붙이면 Hotopay 외부에서 사용되는 결제 번호가 됩니다. (ex.<code>HT1234</code>)</td></tr><tr><td><code>pay_status</code></td><td>string</td><td>결제 상태입니다. 상세 값은 코드테이블에서 <code>PayStatus</code>를 확인해주세요</td></tr><tr><td><code>pay_pg</code></td><td>string</td><td>PG사입니다. 상세 값은 코드테이블에서 <code>PG</code>를 확인해주세요</td></tr><tr><td><code>pay_data</code></td><td>object</td><td>결제 데이터입니다. PG사에서 넘어온 값을 그대로 오브젝트로 리턴합니다.</td></tr><tr><td><code>amount</code></td><td>int</td><td>최종 결제 금액입니다.</td></tr></tbody></table>

### hotopay.activePurchase before

결제 완료 이후 그룹 부여등 결제 후 작업을 진행하기 전에 호출되는 트리거입니다.

BaseObject(-1) 을 리턴받을 경우 결제완료 작업을 진행하지 않습니다.

<table><thead><tr><th width="175">변수명</th><th width="133">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>member_srl</code></td><td>int</td><td>결제한 유저의 고유번호입니다.</td></tr><tr><td><code>purchase_srl</code></td><td>int</td><td>결제 번호입니다.</td></tr></tbody></table>

### hotopay.activePurchase after

결제 완료 후 그 부여 등 작업을 진행하고 호출되는 트리거입니다.

<table><thead><tr><th width="175">변수명</th><th width="133">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>member_srl</code></td><td>int</td><td>결제한 유저의 고유번호입니다.</td></tr><tr><td><code>purchase_srl</code></td><td>int</td><td>결제 번호입니다.</td></tr><tr><td><code>group_srls</code></td><td>array(int, ..)</td><td>구매한 상품에 대해서 부여된 그룹 번호입니다.</td></tr></tbody></table>

### hotopay.refundPurchase after

Hotopay 관리자 페이지 혹은 PG사에서 환불 완료 후 호출되는 트리거입니다.

<table><thead><tr><th width="175">변수명</th><th width="133">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>member_srl</code></td><td>int</td><td>환불한 유저의 고유번호입니다.</td></tr><tr><td><code>purchase_srl</code></td><td>int</td><td>환불된 결제 번호입니다.</td></tr></tbody></table>

### hotopay.renewSubscription before

Cron에서 결제를 진행하기 전에 호출되는 트리거입니다.

BaseObject(-1) 을 리턴받을 경우 정기결제를 취소하며, 결제를 진행하지 않습니다.

<table><thead><tr><th width="177">변수명</th><th width="134">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>subscription_srl</code></td><td>int</td><td>정기결제 데이터 번호입니다. 결제 번호와 다릅니다.</td></tr><tr><td><code>member_srl</code></td><td>int</td><td>정기결제 데이터를 등록한 유저의 고유번호입니다.</td></tr><tr><td><code>pg</code></td><td>string</td><td>PG사입니다. 상세 값은 코드테이블에서 <code>PG</code>를 확인해주세요</td></tr><tr><td><code>price</code></td><td>int</td><td>정기결제 금액입니다.</td></tr><tr><td><code>product_srl</code></td><td>int</td><td>상품 번호입니다.</td></tr><tr><td><code>option_srl</code></td><td>int</td><td>옵션 번호입니다.</td></tr><tr><td><code>quantity</code></td><td>int</td><td>수량입니다.</td></tr><tr><td><code>billing_key_idx</code></td><td>int</td><td>빌링키 번호입니다.</td></tr><tr><td><code>register_date</code></td><td>datetime (Y-m-d H:i:s)</td><td>정기결제가 시작된 날짜입니다.</td></tr><tr><td><code>esti_billing_date</code></td><td>datetime (Y-m-d H:i:s)</td><td>예정된 정기결제 날입니다.</td></tr></tbody></table>

### hotopay.renewSubscription after

Cron에서 결제를 진행한 후에 호출되는 트리거입니다.

`hotopay.renewSubscription before` 데이터에 아래 데이터가 추가로 붙어 나옵니다.

<table><thead><tr><th width="179.33333333333331">변수명</th><th width="133">타입</th><th>설명</th></tr></thead><tbody><tr><td><code>purchase_srl</code></td><td>int</td><td>결제 번호입니다.</td></tr><tr><td><code>billing_status</code></td><td>string</td><td>빌링 상태입니다. 상세 값은 코드테이블에서 <code>BillingStatus</code>를 확인해주세요</td></tr><tr><td><code>esti_billing_date</code></td><td>datetime (Y-m-d H:i:s)</td><td>갱신된 다음 결제일입니다.</td></tr></tbody></table>

### hotopay.cron after

Cron이 완전히 실행된 이후 실행되는 트리거입니다. (1.4.7 이후 추가)

별도의 추가 데이터는 없습니다.

<table><thead><tr><th width="203.33333333333331">변수명</th><th width="133">타입</th><th>설명</th></tr></thead><tbody><tr><td></td><td></td><td></td></tr></tbody></table>
