binance / binance-pay-connector-python

A lightweight library that works as a connector to Binance pay public API
15 stars 11 forks source link

Request Header Verification Example For Webhooks #4

Closed ibn-icena closed 2 years ago

ibn-icena commented 2 years ago

Hello,

I would like to verify the headers of webhooks (Order Notification), as it is suggested in the documentation, but the given example codes are in either PHP or java on the documentation page (https://developers.binance.com/docs/binance-pay/webhook-common). Is there any example for verification of Request Header elements especially for BinancePay-Signature?

chairz commented 2 years ago

https://github.com/BitDJ/binance-pay-signature-examples

This is related to the signatures. Are you looking for a python example?

ibn-icena commented 2 years ago

https://github.com/BitDJ/binance-pay-signature-examples

The provided link is not available and throws a 404 error. I am looking for an example for validating headers of webhook notifications.

chairz commented 2 years ago

My bad this should be the correct link https://github.com/binance/binance-pay-signature-examples

ibn-icena commented 2 years ago

The example in https://github.com/binance/binance-pay-signature-examples shows how to send a signed request to Binance Pay api but I am looking for an example, where the payment is either accepted or declined and binance servers send a POST request to my servers with encrypted data in headers. These requests must be validated but I was not able to find a similar function in python like

openssl_verify($payload, $decodedSignature, $publicKey, OPENSSL_ALGO_SHA256 ); //in PHP

In the documentation(https://developers.binance.com/docs/binance-pay/webhook-common) there are examples only for java and PHP.

chairz commented 2 years ago

https://github.com/binance/binance-pay-signature-examples/blob/master/python/webhook.py

I have done a demo in python. Hope this helps.

ibn-icena commented 2 years ago

Thank you for the example. It helped me.