Ich habe einen Webhook, bei dem mein Square-Konto Anfragen an jedes Mal sendet, wenn ein PAYMENT_UPDATED
-Ereignis bei einer Bestellung auftritt. Ich verfolge die API-Dokumentation hier: https://docs.connect.squareup.com/api/connect/v1/#setupwebhooksSquare API: Zahlungsbenachrichtigungen Webhook falsche Händler ID zurückgegeben?
Er sagt, dass der Webhook eine Anfrage mit diesen Parametern zu meiner App macht:
{
"merchant_id": "18YC4JBH91E1H",
"location_id": "JGHJ0343",
"event_type": "PAYMENT_UPDATED",
"entity_id": "Jq74mCczmFXk1tC10GB"
}
Dies ist der Code in meinem Knoten App:
Index 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);
},
};
Meine App druckt den gleichen Wert für location_id
und merchant_id
in den Protokollen für jeden der Aufträge. Ich überprüfte meine Datenbank und diese ID ist eine Standort-ID, keine Händler-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
Was ist los?
In einigen Fällen könnten eine Händler-ID und eine Standort-ID identisch sein, aber das sieht wahrscheinlich nicht nach Ihrem Fall aus. Stimmt es, dass Sie mit einem großen Multi-Location-Café arbeiten? – tristansokol
Ja, Sie haben Recht. Aus meinen Logs sieht es so aus, als wären alle Location-IDs identisch mit der Merchant-ID – Edmund
Gotcha. Haben Sie kürzlich Ihre Webhook-Konfigurationen aktualisiert? – tristansokol