跳至主要內容

如何使用 Webhook 來檢查付款狀態

昨日已更新

總覽

您可以在您的 WATI 帳戶中設定 Webhook,以便接收各種事件的即時更新,包括 付款狀態 通知。這可讓您的系統在付款被捕獲失敗時自動做出反應。

💡提示:要啟用此 Webhook,請前往您的 WATI 帳戶中的 Webhook 頁面。

付款狀態 Webhook 負載

在處理付款時,Webhook 將發送以下狀態值之一:

  • "captured" – 付款已成功完成

  • "failed" – 付款嘗試失敗

範例 Webhook 負載(捕獲或失敗的付款)

{
"statuses": [
{
"from": "contact-phone-number",
"id": "ABMAAQVBAXmFlQ",
"payment": {
"reference_id": "your-reference-id",
"sender": "12137725260"
},
"status": "captured", // 或 "failed"
"timestamp": "1667283493",
"type": "payment"
}
]
}

訊息狀態 Webhook

訂單訊息成功發送至客戶時,您也會收到 Webhook 事件通知。

範例 Webhook 負載(訊息已發送)

{
"statuses": [
{
"conversation": {
"expiration_timestamp": 1667297460,
"id": "3fd5f2da086a01a3d8aaa5be596c3974",
"origin": {
"type": "user_initiated"
}
},
"id": "gBEGkYYGMoJXAgmE6nNS5OrwajQ",
"message": {
"recipient_id": "recipient-phone-number"
},
"pricing": {
"billable": true,
"category": "user_initiated",
"pricing_model": "CBP"
},
"recipient_id": "recipient-phone-number",
"status": "sent",
"timestamp": "1667211460",
"type": "message"
}
]
}

是否回答了您的問題?