From c58a1aaa4891348e00fe3526e2301cf696239a49 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 22 Dec 2023 14:23:17 +0100 Subject: [PATCH] PayPal: Add idempotency ID as per https://developer.paypal.com/api/rest/reference/idempotency/ --- src/pretix/plugins/paypal2/client/core/paypal_http_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pretix/plugins/paypal2/client/core/paypal_http_client.py b/src/pretix/plugins/paypal2/client/core/paypal_http_client.py index f3ae46abc3..714ad0954f 100644 --- a/src/pretix/plugins/paypal2/client/core/paypal_http_client.py +++ b/src/pretix/plugins/paypal2/client/core/paypal_http_client.py @@ -22,6 +22,7 @@ import copy import hashlib import logging +import uuid import requests from django.core.cache import cache @@ -110,6 +111,9 @@ class PayPalHttpClient(VendorPayPalHttpClient): if self.environment.partner_id: request.headers["PayPal-Partner-Attribution-Id"] = self.environment.partner_id + if "PayPal-Request-Id" not in request.headers: + request.headers["PayPal-Request-Id"] = str(uuid.uuid4()) + def execute(self, request): reqCpy = copy.deepcopy(request)