【发布时间】:2021-08-07 22:28:35
【问题描述】:
我需要验证收到的 PayPal webhook 的签名。 (PayPal-Python-SDK 不是一个选项,因为它已被弃用)
这是我正在尝试的:
access_token = "Bearer " + r['access_token']
data = {"auth_algo": auth_algo,
"transmission_id": transmission_id,
"transmission_sig": transmission_sig,
"transmission_time": transmission_time,
"webhook_id": webhookID,
"webhook_event": res,
"cert_url":cert_url }
headers = {"Authorization":access_token, "Content-Type": "application/json"}
response = requests.post("https://api-m.paypal.com/v1/notifications/verify-webhook-signature", data=data, headers=headers)
得到 400 响应:
{'name': 'VALIDATION_ERROR', 'message': '无效请求 - 查看详情', 'debug_id': '4d3f231bb0c69', 'details': [{'location': 'body', 'issue': 'MALFORMED_REQUEST_JSON'}],'链接':[]}
- 我不确定访问令牌是否应该放在标头中。
- 也不确定网址是否正确,但请注意我是 在生产环境中进行测试,而不是在沙盒中。
- 也不确定是否应该在
上添加“Bearer”前缀 令牌。
我正在尝试遵循本指南: https://developer.paypal.com/docs/api/webhooks/v1/#verify-webhook-signature_post
【问题讨论】: