Skip to main content

pretix-thepay

ThePay payment provider for pretix: card payments, bank transfers and the other ThePay methods, with automatic refunds.

How it works

  1. The customer chooses The Pay. pretix creates a ThePay payment and redirects the customer.

  2. The state is always read from ThePay over the authenticated API, never taken from the request. Three things trigger that read:

    • the customer returning,

    • ThePay’s notifications,

    • a periodic task.

    The periodic task covers notifications ThePay gave up on, since it retries them for only 2 days.

  3. A bank transfer can arrive a working day or more later. The payment stays pending and is confirmed by the notification. ThePay accepts the payment until the order’s payment term plus a configurable number of days. After that, ThePay returns a late transfer to the payer automatically.

  4. Refunds, including customers cancelling their own orders, are sent to ThePay. pretix shows a refund as done only once ThePay reports it as returned. A refund ThePay declines becomes failed and is logged. Refunds made in the ThePay administration appear in pretix as external refunds.

Requirements

  • pretix 2025.1 or later, Python 3.11 or later

  • A ThePay project (merchant ID, project ID, API password)

Installation

pip install pretix-thepay

In production we bake it into the pretix image, see https://github.com/KrisIsNew/hellpretix. Enable the plugin per event, then configure it under Settings → Payment → The Pay.

Configuration

Merchant ID, Project ID,

ThePay administration → Implementation

API password

Fallback gateway language

Used when the order’s language is not one ThePay offers (cs, sk, en)

Days payable after the term

Default 3. Match pretix’s Accept late payments setting.

Let ThePay e-mail the customer

ThePay’s own e-mails, e.g. bank details for a transfer

Demo environment

demo.api.thepay.cz with demo credentials

Operational requirements:

  • IP whitelist: add the public IP of the pretix server in ThePay administration → Implementation.

  • Clock: ThePay rejects requests whose SignatureDate is more than 20 s off, so run NTP.

  • Periodic task: pretix’s runperiodic must run (the standalone image does this). The plugin re-checks open payments and refunds at most every 10 minutes.

  • Refund balance: ThePay pays refunds from your ThePay balance. Without enough balance it waits 10 days and then declines the refund.

Cancellations and automatic refunds

Event → Settings → Cancellation:

  • Allow customers to cancel paid orders.

  • Choose to refund automatically to the original payment method.

pretix refunds automatically only when ThePay can. Otherwise it creates a manual refund for you. ThePay cannot refund automatically:

  • card payments older than 6 months,

  • bank transfers whose payer account ThePay does not know (e.g. cash deposits),

  • methods without the returnable tag.

Development

pip install -e ".[test]"
pytest
flake8 pretix_thepay tests && isort --check-only pretix_thepay tests

The tests run against a real pretix (pretix.testutils.settings, SQLite) with the ThePay API mocked by responses. Releasing: see RELEASING.md.

References

License

Apache License 2.0

Metadata

Release files for pretix-thepay 9.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pretix-thepay 9.1.0
File Size Uploaded
pretix_thepay-9.1.0.tar.gz 25.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pretix-thepay 9.1.0
File Interpreter ABI Platform
pretix_thepay-9.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.1 kB

Release files / pretix_thepay-9.1.0.tar.gz

Download URL pretix_thepay-9.1.0.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
64eb44be1e74c8b0579bcfc230a62180fa3c64700be7ef4d05ea36af56076fdf
BLAKE2b-256 checksum
How to use checksums
a833aa84f4887ec6f30763edf84023f73367c28af19f2522b7a88875825c6b18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pretix_thepay-9.1.0-py3-none-any.whl

Download URL pretix_thepay-9.1.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
755ca00c7203741b03a5846b3346f6fa375cc74912520d1b467ecc09c938f646
BLAKE2b-256 checksum
How to use checksums
074b23f7b3d78a361093440188a045c946ffc8d03ceea3e836fdc371337faa18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

9.1.0 This release

2 release files

9.0.24

2 release files

9.0.23

2 release files

9.0.22

2 release files

9.0.21

2 release files

9.0.20

2 release files

9.0.19

2 release files

9.0.18

2 release files

9.0.17

2 release files

9.0.16

2 release files

9.0.15

2 release files

9.0.14

2 release files

9.0.13

2 release files

9.0.12

2 release files

9.0.11

2 release files

9.0.9

2 release files

9.0.8

2 release files

9.0.7

1 release file

9.0.6

2 release files

9.0.5

2 release files

9.0.4

2 release files

9.0.3

2 release files

9.0.2

2 release files

9.0.1

2 release files

6.0.2

2 release files

6.0.1

2 release files

3.0.1

2 release files

2.0.1

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page