Skip to content

Releases: payload-code/payload-python

v0.5.1

03 Feb 19:51
v0.5.1
9ac4eca

Choose a tag to compare

Release v0.5.1

🎉 Major Features

Query Builder Methods

This release adds Django-inspired query builder methods for more intuitive data retrieval.

Order results:

# Single field (ascending)
payments = Payment.order_by('created_at').all()

# Multiple fields with descending (use 'desc()')
payments = Payment.order_by('dect(created_at)', 'amount').all()

Limit and offset:

# Limit results
payments = Payment.limit(10).all()

# Offset (skip) results
payments = Payment.offset(20).all()

# Chain them together
payments = (Payment
    .filter_by(status='paid')
    .order_by('dect(created_at)')
    .limit(10)
    .offset(20)
    .all())

Python Slice Syntax for Pagination

Use familiar Python slice syntax for pagination:

# Get items 10-20
results = Payment.filter_by(status='paid')[10:20]

# Get first 20 items
results = Payment.filter_by(status='paid')[:20]

# Get everything after item 10
results = Payment.filter_by(status='paid')[10:]

# Get all items (equivalent to .all())
results = Payment.filter_by(status='paid')[:]

Slice behavior:

  • [10:20] → offset=10, limit=10
  • [:20] → offset=None, limit=20 (first 20 items)
  • [10:] → offset=10, limit=None (from item 10 onwards)
  • [:] → offset=None, limit=None (all items)
  • [0:10] → offset=None, limit=10 (treats 0 as "from beginning")

Direct Iteration Support

Iterate directly over query results:

# Iterate directly over request
for payment in Payment.filter_by(status='paid').limit(10):
    print(payment.id)

# List comprehension support
ids = [p.id for p in Payment.filter_by(status='paid')]

Dot Notation for Nested Objects

Access nested JSON fields using dot notation:

txn = pl.Transaction.get('txn_3w8Z....')
txn.sender.method  # Access nested fields via dot notation

✨ New Features

Filter Combination with OR Operator

# Combine filters with | operator
filter1 = Attr.status == 'active'
filter2 = Attr.status == 'pending'
combined = filter1 | filter2  # status=active|pending

Payment.filter_by(combined).all()

Star Operator in Select

# Expand all fields from an object
pl.Transaction.select(*p.Transaction, pl.attr.invoice_allocations)

New API V2 Objects

  • WebhookLog - Webhook event logs
  • InvoiceAttachment - Invoice attachments

🐛 Bug Fixes

  • Fixed Filter.__or__() to return proper Equal instance instead of base Filter
  • Fixed endpoint paths for Entity and ProcessingSettings to handle pluralization correctly
  • Fixed all pre-existing broken tests due to response.text vs response.json() changes

🔧 Improvements

  • Comprehensive test coverage: Added 219 unit tests (100% passing) covering:
    • Attribute filtering and operators
    • Object wrapper functionality
    • Request builder methods (order_by, limit, offset, slice syntax)
    • Iteration support
    • DotDict functionality
  • Better code organization: Improved PEP 8 compliance and code formatting throughout
  • Enhanced API: Methods are chainable for fluent query building
  • Better error handling: Proper validation for edge cases (e.g., negative slice indices)

🔄 Breaking Changes

None - this release is fully backward compatible. All new features are additive.

📦 Dependencies

  • Updated pdm.lock with latest dependency resolutions

Full Changelog: v0.5.0...v0.5.1

v0.5.0

21 Jan 17:44
v0.5.0
0fd6fb1

Choose a tag to compare

Release v0.5.0

🎉 Major Features

Payload API V2 Support

This release adds full support for Payload API V2, allowing you to specify which API version to use when making requests.

Configure API version globally:

import payload as pl
pl.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE'
pl.api_version = 'v2'  # Use API v2

Or per-session:

import payload
pl = payload.Session(
    'secret_key_3bW9JMZtPVDOfFNzwRdfE',
    api_version='v2'
)

✨ New API V2 Objects

The following new object types are now available (introduced in API v2):

  • Profile - User profiles
  • Intent - Payment intents
  • Entity - Business entities
  • Transfer - Fund transfers
  • ProcessingAgreement - Processing agreements
  • Stakeholder - Entity stakeholders
  • BillingItem - Billing line items
  • InvoiceItem - Invoice line items
  • PaymentAllocation - Payment allocations
  • TransactionOperation - Transaction operations
  • CheckFront / CheckBack - Check images
  • ProcessingSettings - Processing configuration

See the Payload API Documentation for details on using these objects.

🔧 Improvements

  • Enhanced exports: All objects, exceptions, and functions are now explicitly exported from the main payload module with proper __all__ definition
  • Better test organization: Tests are now organized into tests/int/ (integration tests) and tests/unit/ (unit tests)
  • Improved test data generation: Added Faker library for generating realistic test data (e.g., card expiration dates)
  • Comprehensive unit tests: Added extensive unit tests for API version header functionality across all HTTP methods (GET, POST, PUT, DELETE)
  • Code formatting: Improved code consistency with standardized string quotes and formatting throughout the codebase

📚 Documentation

  • Updated README with API versioning examples
  • Improved testing documentation with separate commands for unit and integration tests
  • Fixed heading hierarchy in installation section

🔄 Breaking Changes

None - this release is fully backward compatible. If you don't specify an api_version, the SDK will continue to work with your current API version.

📦 Dependencies

  • Added faker to development dependencies for test data generation

PRs

Full Changelog

v0.4.11...v0.5.0

v0.4.11

11 Sep 00:42
v0.4.11
9c208b0

Choose a tag to compare

What's Changed

Full Changelog: v0.4.10...v0.4.11

v0.4.10

09 May 01:26
8da724c

Choose a tag to compare

What's Changed

Full Changelog: v0.4.9...v0.4.10

v0.4.9

10 Apr 03:30
abed8eb

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.4.6...v0.4.9

v0.4.7

26 Jul 00:26
ea28f25

Choose a tag to compare

What's Changed

  • Added pl.ClientToken. See the new documentation on temporary client token authentication
  • Added pylint, black, and precommit for local development

Full Changelog: v0.4.6...v0.4.7

v0.4.6

17 Jul 22:02
655081c

Choose a tag to compare

  • added unit tests for request class
  • migrated from pipenv to pdm for local dev
  • fixed typos in error messages