【发布时间】:2022-02-01 18:05:48
【问题描述】:
我正在尝试为我的支付系统实施 webhook。我有一个到我的 webhook 视图的路径,这是一个简单的定义,其中打印了提供的 id。
用法是这样的
http://localhost:8000/api/mollie-webhook/?id=ExampleId
路径
# mollie webhook
path('api/mollie-webhook/', mollie_webhook, name='mollie_webhook'),
查看
def mollie_webhook(request):
id = request.POST['id']
print(id)
return JsonResponse(data={"response": "Success!"})
我收到以下错误
CSRF verification failed. Request aborted.
【问题讨论】:
-
将视图标记为 csrf_exempt docs.djangoproject.com/en/4.0/ref/csrf/…?
-
@IainShelvington 就像一个魅力。谢谢!您可以创建一个答案,以便我选择它。
标签: python django django-rest-framework webhooks mollie