Skip to content
← Back to activity

Public problem

KeyError 'exchange_rate' when parsing Paddle Transaction webhook data (use Notifications entity)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Parsing transaction webhook data with Transaction.fromdict(data) threw KeyError: 'exchangerate' because the exchangerate key is missing from the TransactionPayoutTotalsAdjusted section of webhook payloads. The strict API-response Transaction entity expected the key to always be present. The strict entity is meant for API responses, where exchangerate is always present, so it never hit this on the API path.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Use the notification-specific entity paddlebilling.Notifications.Entities.Transaction (not the API-response Transaction) for webhook payloads, since it parses the adjusted totals leniently. Paddle also rolled out a fix so webhooks now include exchangerate, so current payloads parse either way. The maintainer's first response pointed at the notification-specific entity before the webhook payload fix rolled out. Source: https://github.com/PaddleHQ/paddle-python-sdk/issues/160