Skip to content

Commit

Permalink
PayPal: Add idempotency ID as per https://developer.paypal.com/api/re…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Dec 22, 2023
1 parent 385c8c6 commit c58a1aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pretix/plugins/paypal2/client/core/paypal_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import copy
import hashlib
import logging
import uuid

import requests
from django.core.cache import cache
Expand Down Expand Up @@ -110,6 +111,9 @@ def __call__(self, request):
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)

Expand Down

0 comments on commit c58a1aa

Please sign in to comment.