Adyen Python API Docs | dltHub
Build a Adyen-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.
Last updated:
Adyen is a global payments platform that provides REST APIs to accept, manage, and reconcile online and in‑store payments. The REST API base URL is Test (Checkout): https://checkout-test.adyen.com/checkout/{version} Test (Classic PAL): https://pal-test.adyen.com/pal/servlet/Payment/{version} Live: merchant-specific hostnames documented in the Customer Area (example pattern: https://{prefix}-checkout-live.adyenpayments.com/checkout/{version}) and all requests require an Adyen API key supplied in the X-API-Key header (or account credentials for legacy PAL endpoints)..
dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Adyen data in under 10 minutes.
What data can I load from Adyen?
Here are some of the endpoints you can load from Adyen:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| checkout_sessions | GET /sessions/{sessionId} | GET | (session object) | Retrieve the result/object for a payment session |
| payment_links | GET /paymentLinks/{linkId} | GET | (single object) | Retrieve a payment link by id |
| stored_payment_methods | GET /storedPaymentMethods | GET | storedPaymentMethods | Get tokens/stored payment details for a shopper/account |
| payment_methods (Checkout POST exists; listed for completeness) | POST /paymentMethods | POST | paymentMethods | Return payment methods available for a payment request |
| payment_links_list | GET /paymentLinks (if available in Management) | GET | (depends on endpoint) | List payment links (note: Checkout provides GET /paymentLinks/{linkId} and PATCH; creation is POST) |
| management_terminals | GET /terminals | GET | terminals | List terminals associated with account (Management API) |
| postfmapi_getTerminalsUnderAccount | POST /postfmapi/1/post/getTerminalsUnderAccount | POST | terminals | Return terminals under account (this API uses POST but returns terminals list) |
How do I authenticate with the Adyen API?
Adyen uses API keys for most modern APIs. Provide the API key in the X-API-Key HTTP header for server‑to‑server requests. Some older/classic APIs (PAL) use username/password/API credential roles; live endpoints require configured account roles and merchant-specific prefixes.
1. Get your credentials
- Sign in to the Adyen Customer Area (CA) as a user with Developer/merchant technical integrator role. 2. Go to Developers > API credentials (or API URLs & Response) in the Customer Area. 3. Create a new API credential (select appropriate roles/scopes for the APIs you will call) and copy the generated API key. 4. For live use, note the account's live URL prefix from Developers > API URLs and use the merchant-specific live hostname when constructing requests.
2. Add them to .dlt/secrets.toml
[sources.adyen_source] api_key = "your_adyen_api_key_here"
dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.
How do I set up and run the pipeline?
Set up a virtual environment and install dlt:
uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"
1. Install the dlt AI Workbench:
dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex
This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →
2. Install the rest-api-pipeline toolkit:
dlt ai toolkit rest-api-pipeline install
This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →
3. Start LLM-assisted coding:
Use /find-source to load data from the Adyen API into DuckDB.
The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.
4. Run the pipeline:
python adyen_pipeline.py
If everything is configured correctly, you'll see output like this:
Pipeline adyen_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset adyen_data The duckdb destination used duckdb:/adyen.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs
Inspect your pipeline and data:
dlt pipeline adyen_pipeline show
This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.
Python pipeline example
This example loads stored_payment_methods and payment_links from the Adyen API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def adyen_source(api_key=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "Test (Checkout): https://checkout-test.adyen.com/checkout/{version} Test (Classic PAL): https://pal-test.adyen.com/pal/servlet/Payment/{version} Live: merchant-specific hostnames documented in the Customer Area (example pattern: https://{prefix}-checkout-live.adyenpayments.com/checkout/{version})", "auth": { "type": "api_key", "api_key": api_key, }, }, "resources": [ {"name": "stored_payment_methods", "endpoint": {"path": "storedPaymentMethods", "data_selector": "storedPaymentMethods"}}, {"name": "payment_links", "endpoint": {"path": "paymentLinks/{linkId}"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="adyen_pipeline", destination="duckdb", dataset_name="adyen_data", ) load_info = pipeline.run(adyen_source()) print(load_info)
To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.
How do I query the loaded data?
Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("adyen_pipeline").dataset() sessions_df = data.stored_payment_methods.df() print(sessions_df.head())
SQL (DuckDB example):
SELECT * FROM adyen_data.stored_payment_methods LIMIT 10;
In a marimo or Jupyter notebook:
import dlt data = dlt.pipeline("adyen_pipeline").dataset() data.stored_payment_methods.df().head()
See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.
What destinations can I load Adyen data to?
dlt supports loading into any of these destinations — only the destination parameter changes:
| Destination | Example value |
|---|---|
| DuckDB (local, default) | "duckdb" |
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.
Troubleshooting
Authentication failures
If you receive 401 or 403, verify that X-API-Key is present and correct, the API key has the required roles/scopes, and you are using the correct environment (test vs live) and merchant-specific hostname for live.
Live endpoint hostname / prefix
Live API hostnames include a merchant-specific prefix. If requests to live endpoints return DNS/hostname errors or 403, confirm your account's live URL prefix in Customer Area > Developers > API URLs and use the correct host.
Rate limits and retries
Adyen enforces throttling; if you receive 429, implement exponential backoff and retry. For idempotent operations ensure you use idempotency keys where supported.
Pagination and lists
Many Adyen endpoints return named arrays (e.g., paymentMethods, storedPaymentMethods, terminals). Check the API Explorer example responses and OpenAPI definitions to confirm the correct array key for each endpoint.
Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.
Next steps
Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:
data-exploration— Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.dlthub-runtime— Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install
Was this page helpful?
Community Hub
Need more dlt context for Adyen?
Request dlt skills, commands, AGENT.md files, and AI-native context.