Transactions API
Transactions API https://paystack.com/docs/api/transaction/
- class djpaystack.api.transactions.TransactionAPI(client)[source]
Bases:
BaseAPIPaystack Transactions API
The Transactions API allows you create and manage payments on your integration.
- initialize(email: str, amount: int, currency: str | None = None, reference: str | None = None, callback_url: str | None = None, plan: str | None = None, invoice_limit: int | None = None, metadata: Dict[str, Any] | None = None, channels: List[str] | None = None, split_code: str | None = None, split: Dict[str, Any] | None = None, subaccount: str | None = None, transaction_charge: int | None = None, bearer: str | None = None, **kwargs) Dict[str, Any][source]
Initialize a transaction
- Parameters:
email – Customer’s email address
amount – Amount in kobo (multiply naira by 100)
currency – Currency (NGN, GHS, ZAR, or USD)
reference – Unique transaction reference
callback_url – URL to redirect after payment
plan – Plan code for subscription
invoice_limit – Number of times to charge customer during subscription
metadata – Additional transaction data
channels – Payment channels to control (card, bank, ussd, qr, mobile_money, bank_transfer)
split_code – Transaction split code (for pre-configured splits)
split – Dynamic split object with ‘type’, ‘bearer_type’, ‘subaccounts’ e.g. {“type”: “flat”, “bearer_type”: “account”, “subaccounts”: [{“subaccount”: “ACCT_xxx”, “share”: 6000}]}
subaccount – Subaccount code
transaction_charge – Amount to charge subaccount
bearer – Who bears Paystack charges (account, subaccount)
- Returns:
Response with authorization_url and access_code
- verify(reference: str) Dict[str, Any][source]
Verify a transaction
- Parameters:
reference – Transaction reference
- Returns:
Transaction details
- list(per_page: int = 50, page: int | None = None, customer: int | None = None, status: str | None = None, from_date: str | None = None, to_date: str | None = None, amount: int | None = None) Dict[str, Any][source]
List transactions
- Parameters:
per_page – Records per page
page – Page number
customer – Customer ID
status – Transaction status (failed, success, abandoned)
from_date – Start date (YYYY-MM-DD)
to_date – End date (YYYY-MM-DD)
amount – Transaction amount
- Returns:
List of transactions
- fetch(id_or_reference: str) Dict[str, Any][source]
Fetch a single transaction
- Parameters:
id_or_reference – Transaction ID or reference
- Returns:
Transaction details
- charge_authorization(authorization_code: str, email: str, amount: int, reference: str | None = None, currency: str | None = None, metadata: Dict[str, Any] | None = None, channels: List[str] | None = None, subaccount: str | None = None, transaction_charge: int | None = None, bearer: str | None = None, queue: bool | None = None, split_code: str | None = None, callback_url: str | None = None, **kwargs) Dict[str, Any][source]
Charge an authorization
- Parameters:
authorization_code – Authorization code for card or direct debit
email – Customer’s email (must match the email used to create the authorization)
amount – Amount in kobo
reference – Unique transaction reference
currency – Currency code
metadata – Additional transaction data
channels – Payment channels
subaccount – Subaccount code
transaction_charge – Amount to charge subaccount
bearer – Who bears Paystack charges
queue – Queue transaction for later processing
split_code – Transaction split code for multi-split payments
callback_url – URL to redirect if 2FA challenge is required
- Returns:
Transaction response
- check_authorization(authorization_code: str, email: str, amount: int, currency: str | None = None) Dict[str, Any][source]
Check if authorization is valid for amount
- Parameters:
authorization_code – Authorization code
email – Customer’s email
amount – Amount in kobo
currency – Currency code
- Returns:
Validation response
- timeline(id_or_reference: str) Dict[str, Any][source]
View transaction timeline
- Parameters:
id_or_reference – Transaction ID or reference
- Returns:
Transaction timeline
- totals(per_page: int = 50, page: int | None = None, from_date: str | None = None, to_date: str | None = None) Dict[str, Any][source]
Get transaction totals
- Parameters:
per_page – Records per page
page – Page number
from_date – Start date
to_date – End date
- Returns:
Transaction totals
- export(per_page: int = 50, page: int | None = None, from_date: str | None = None, to_date: str | None = None, customer: int | None = None, status: str | None = None, currency: str | None = None, amount: int | None = None, settled: bool | None = None, settlement: int | None = None, payment_page: int | None = None) Dict[str, Any][source]
Export transactions
- Parameters:
per_page – Records per page
page – Page number
from_date – Start date
to_date – End date
customer – Customer ID
status – Transaction status
currency – Currency
amount – Amount
settled – Settlement status
settlement – Settlement ID
payment_page – Payment page ID
- Returns:
Export response with download link
- partial_debit(authorization_code: str, currency: str, amount: int, email: str, reference: str | None = None, at_least: int | None = None) Dict[str, Any][source]
Partial debit allows you to retrieve part of a payment from a customer
- Parameters:
authorization_code – Authorization code
currency – Currency
amount – Amount in kobo
email – Customer email
reference – Transaction reference
at_least – Minimum amount to charge
- Returns:
Transaction response
Quick Reference
from djpaystack import PaystackClient
client = PaystackClient()
# Initialize (with optional dynamic split)
client.transactions.initialize(email=..., amount=..., split={...})
# Verify
client.transactions.verify(reference=...)
# Charge saved authorization (with optional split_code)
client.transactions.charge_authorization(
authorization_code=..., email=..., amount=...,
split_code=..., callback_url=...,
)
# List / Fetch / Timeline / Export / Totals
client.transactions.list(page=1, per_page=50)
client.transactions.fetch(id=...)
client.transactions.timeline(id_or_reference=...)
client.transactions.export(from_=..., to=...)
client.transactions.totals()