0
我有一個webhook,我的Square帳戶正在向訂單發生PAYMENT_UPDATED
事件時發出請求。我在這裏以下API文檔:https://docs.connect.squareup.com/api/connect/v1/#setupwebhooks廣場API:付款通知webhook返回錯誤的商家ID?
它說,網絡掛接讓我的應用程序使用這些參數要求:
{
"merchant_id": "18YC4JBH91E1H",
"location_id": "JGHJ0343",
"event_type": "PAYMENT_UPDATED",
"entity_id": "Jq74mCczmFXk1tC10GB"
}
這是我節點應用程序的代碼:
指數.js文件
app.post("/payment_notifications", (req, resp) => {
paymentService.receivePayment(req.body, resp);
});
payment_service.js
module.exports = {
receivePayment(requestBody, response){
const { entity_id, location_id, merchant_id } = requestBody;
console.log("payment_id: ", entity_id);
console.log("location_id: ", location_id);
console.log("merchant_id: ", merchant_id);
console.dir("requestBody: ", requestBody);
console.dir("requestBody.merchant_id: ", requestBody.merchant_id);
console.dir("requestBody.location_id: ", requestBody.location_id);
getPayment(entity_id, location_id, merchant_id);
response.sendStatus(200);
},
};
我的應用在每個訂單的日誌中打印相同的值location_id
和merchant_id
。我檢查了我的數據庫,並且該ID是位置ID,而不是商戶ID
2016-11-07T17:28:55.770302+00:00 app[web.1]: payment_id: paymentId123123
2016-11-07T17:28:55.770328+00:00 app[web.1]: location_id: 6HB994C06J6PE
2016-11-07T17:28:55.770366+00:00 app[web.1]: merchant_id: 6HB994C06J6PE
發生了什麼事?
在某些情況下,商家ID和位置ID可能相同,但這不太可能會查看您的情況。我是否正確地與一家大型多地點咖啡店合作? – tristansokol
是的,你是對的。從我的日誌中看起來,所有的位置ID都與商戶ID – Edmund
Gotcha相同。你最近是否更新過任何webhooks配置? – tristansokol