Python SDK
Install and start using the Python SDK.
Intro
The Payrix SDK provides access to the Payrix REST APIs.
Worldpay for Platforms provides beta software development kits (SDKs) for the Payrix Pro REST API, auto-generated by APIMatic in .NET, Java, PHP, Python, Ruby, and TypeScript. Use of Payrix Pro SDKs is optional and at your own risk. Worldpay for Platforms does not provide implementation or troubleshooting support for SDK-specific issues. For important limitations, support details, and compliance requirements, see the Payrix Pro API Beta SDKs Disclaimer.
Installation
To install the SDK from PyPI, with whichever package manager your project uses:
pip install payrix-gp-apimatic-sdkuv add payrix-gp-apimatic-sdkpoetry add payrix-gp-apimatic-sdkTo install from the SDK source instead, give the tool a path containing a slash — a bare folder name is looked up on PyPI, and resolves to whatever project holds that name there:
pip install <path-to-sdk>Quick Start
Synchronous client
Construct PayrixClient with keyword arguments, and call close() when you are done. Every argument is optional.
from payrix import PayrixClient
client = PayrixClient(
api_key="YOUR_API_KEY",
session_key="YOUR_API_KEY",
txn_session_key="YOUR_API_KEY",
username="YOUR_API_KEY",
password="YOUR_API_KEY",
environment="production",
)
client.close()Alternatively, scope it — with PayrixClient(...) as client: closes the pool on exit.
Asynchronous client
AsyncPayrixClient mirrors PayrixClient with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences — for example, the transport argument is custom_async_http_client.
from asyncio import run
from payrix import AsyncPayrixClient
async def main() -> None:
client = AsyncPayrixClient(
api_key="YOUR_API_KEY",
session_key="YOUR_API_KEY",
txn_session_key="YOUR_API_KEY",
username="YOUR_API_KEY",
password="YOUR_API_KEY",
environment="production",
)
await client.aclose()
run(main())Alternatively, scope it — async with AsyncPayrixClient(...) as client: closes the pool on exit.
