invoice.created
주문이 만들어지면 보내는 이벤트예요.
주문이 만들어지면 보내요. API, 대시보드, CSV 업로드, 카페24 연동 중 어디서 만든 주문이든 보내요.
페이로드
| 필드 | 타입 | 설명 |
|---|---|---|
type |
string | "invoice.created" |
invoice |
object | 만든 주문의 주문 객체예요. paid는 false예요. |
{
"type": "invoice.created",
"invoice": {
"id": "ivc_a1b2c3d4e5f6g7h8i9j0k1l2",
"issuerId": "acc_x9y8z7w6v5u4t3s2r1q0p9o8",
"bankAccountIds": [],
"customer": {
"name": "홍길동",
"email": "hong@example.com",
"phoneNumber": "01012345678"
},
"cashReceipt": null,
"amount": 50000,
"paid": false,
"metadata": { "orderId": "ORDER-2026-0001" },
"issuedAt": "2026-04-28T03:14:15.000+00:00",
"expiresAt": "2026-04-29T03:14:15.000+00:00",
"deletedAt": null
}
}
활용
API로 주문을 만들었다면 응답에 같은 정보가 오니 이 이벤트를 따로 처리하지 않아도 돼요. 이런 경우에 쓰세요.
- 대시보드, CSV 업로드, 카페24 연동으로 만든 주문을 내 시스템에 옮겨요.
- 같은 워크스페이스의 다른 서비스가 만든 주문을 추적해요.
if (event.type === "invoice.created") {
await db.invoices.upsert({
paysyncInvoiceId: event.invoice.id,
customerName: event.invoice.customer.name,
amount: event.invoice.amount,
metadata: event.invoice.metadata,
status: "PENDING",
createdAt: new Date(event.invoice.issuedAt),
});
}