Reference
Every resource namespace on PlugipayClient, with method signatures and a one-line description. For full parameter details, follow the link on each section to the matching API resource page.
All methods take their non-id arguments as keyword arguments. Ids and other positional fields are positional.
from plugipay import PlugipayClient
plug = PlugipayClient(key_id="…", secret="…")
Top-level client
| Member |
Signature |
Description |
PlugipayClient(*, key_id, secret, base_url=None, on_behalf_of=None, timeout=30.0, http=None) |
constructor |
See Authentication. |
plug.close() |
None |
Close the underlying httpx.Client (skipped if you passed your own). |
with plug: |
context manager |
Calls close() on exit. |
plug.for_merchant(account_id) |
PlugipayClient |
New client scoped via X-Plugipay-On-Behalf-Of. |
plug.request(*, method, path, body=None, idempotency_key=None, on_behalf_of=None) |
Any |
Low-level escape hatch — signs, sends, unwraps envelope, returns data. |
| Method |
Returns |
create(*, email=None, name=None, phone=None, external_id=None, metadata=None) |
Customer |
get(customer_id) |
Customer |
list(*, limit=None, cursor=None, email=None) |
PageResult[Customer] |
update(customer_id, *, email=None, name=None, phone=None) |
Customer |
| Method |
Returns |
create(*, name, currency, amount, interval) |
Plan |
get(plan_id) |
Plan |
list(*, limit=None, active=None, cursor=None, order=None) |
PageResult[Plan] |
update(plan_id, *, name=None, description=None, active=None, metadata=None) |
Plan |
archive(plan_id) |
Plan |
| Method |
Returns |
create(*, amount, currency, methods, success_url, cancel_url, customer_id=None, line_items=None, expires_in_sec=None, metadata=None, template_id=None) |
CheckoutSession |
get(session_id) |
CheckoutSession |
list(*, limit=None, status=None, customer_id=None) |
PageResult[CheckoutSession] |
cancel(session_id) |
CheckoutSession |
confirm(session_id) |
CheckoutSession |
| Method |
Returns |
create(*, customer_id, currency, lines, discount=None, tax=None, due_at=None, status=None, memo=None) |
Invoice |
get(invoice_id) |
Invoice |
list(*, limit=None, cursor=None, status=None, customer_id=None) |
PageResult[Invoice] |
finalize(invoice_id) |
Invoice |
pay(invoice_id) |
Invoice |
void(invoice_id) |
Invoice |
send_email(invoice_id, *, to=None) |
dict |
| Method |
Returns |
create(*, customer_id, plan_id, price_id, trial_days=None, payment_token_id=None, collection_method=None, metadata=None, initial_discount=None) |
Subscription |
get(subscription_id) |
Subscription |
list(*, limit=None, status=None, customer_id=None, plan_id=None) |
PageResult[Subscription] |
cancel(subscription_id, *, at="period_end") |
Subscription |
pause(subscription_id, *, resume_at=None) |
Subscription |
resume(subscription_id) |
Subscription |
| Method |
Returns |
create(*, source_type, source_id, amount=None, reason=None) |
Refund |
get(refund_id) |
Refund |
list(*, limit=None, cursor=None, status=None, source_id=None) |
PageResult[Refund] |
| Method |
Returns |
create(*, amount, currency, bank_code=None, bank_name=None, bank_account_number=None, bank_account_holder=None, note=None) |
Payout |
get(payout_id) |
Payout |
list(*, limit=None, cursor=None, status=None) |
PageResult[Payout] |
cancel(payout_id) |
Payout |
mark_in_transit(payout_id, *, reference=None) |
Payout |
mark_paid(payout_id, *, reference=None) |
Payout |
mark_failed(payout_id, *, failure_reason) |
Payout |
balance() |
AvailableBalance |
get_bank_account() |
BankAccount |
update_bank_account(*, bank_name, bank_account_number, bank_account_holder, bank_code=None) |
BankAccount |
| Method |
Returns |
list(*, limit=None, cursor=None, order=None, tx_id=None, code=None, source_type=None, source_id=None) |
PageResult[LedgerEntry] |
balances() |
list[LedgerBalance] |
| Method |
Returns |
pnl(*, from_, to, currency=None) |
PnLReport |
cash_flow(*, from_, to, currency=None) |
CashFlowReport |
Note the trailing underscore on from_. from is a Python keyword, so the SDK uses from_ (PEP 8 convention). It maps to the from query parameter on the wire.
| Method |
Returns |
list(*, limit=None, cursor=None, order=None, type=None, occurred_after=None, occurred_before=None) |
PageResult[EventRecord] |
get(event_id) |
EventRecord |
| Method |
Returns |
list() |
list[WebhookEndpoint] |
create(*, url, events=None, description=None) |
WebhookEndpoint |
delete(endpoint_id) |
None |
| Method |
Returns |
list() |
list[AdapterConfig] |
update_xendit(config) |
AdapterConfig |
update_paypal(config) |
AdapterConfig |
update_midtrans(config) |
AdapterConfig |
update_manual(config) |
AdapterConfig |
managed_onboarding_state() |
ManagedOnboardingState |
start_managed_onboarding(*, kind="xendit", details=None) |
ManagedOnboardingState |
simulate_managed_onboarding(*, result="verified") |
ManagedOnboardingState |
| Method |
Returns |
create(*, customer_id, return_url) |
PortalSession |
| Method |
Returns |
list(*, limit=None, cursor=None, source_type=None, customer_id=None, issued_after=None, issued_before=None) |
PageResult[ReceiptSummary] |
get(receipt_id) |
dict — full receipt payload |
| Method |
Returns |
list() |
list[ApiKey] |
create(*, description=None, scope=None) |
ApiKey — secret only present on this call |
revoke(key_id) |
None |
| Method |
Returns |
list(*, kind=None) |
list[Template] |
get(template_id) |
Template |
create(*, kind, name, document) |
Template |
update(template_id, *, name=None, document=None) |
Template |
make_default(template_id) |
Template |
duplicate(template_id, *, name=None) |
Template |
preview(*, kind, document, sample_data=None) |
dict |
delete(template_id) |
None |
| Method |
Returns |
image(*, filename, mime, base64) |
UploadedFile |
| Method |
Returns |
list() |
list[Workspace] |
create(*, brand_name=None, business_email=None) |
Workspace |
update(workspace_id, *, brand_name=None, business_email=None) |
Workspace |
delete(workspace_id) |
None |
| Method |
Returns |
get() |
AccountProfile |
update(*, name=None) |
AccountProfile |
list_sessions() |
list[BrowserSession] |
revoke_session(session_id) |
None |
revoke_all_sessions() |
dict |
list_linked() |
list[LinkedAccount] |
unlink(provider) |
None |
change_email(*, new_email, password) |
dict |
change_password(*, current_password, new_password) |
None |
list_members() |
list[WorkspaceMember] |
| Method |
Returns |
get() |
CheckoutSettings |
update(patch) |
CheckoutSettings |
| Method |
Returns |
list_tiers() |
list[BillingTier] |
list_plans() |
list[Plan] |
refresh_tiers() |
dict |
| Method |
Returns |
provision_managed(*, business_email, brand_name=None) |
Workspace |
admin_portal — internal operator endpoints
Restricted to Plugipay operators with admin-portal access. Most merchants will never hit these.
| Method |
Returns |
me() |
AdminPortalIdentity |
list_billing_accounts() |
list |
update_billing_account(account_id, patch) |
Any |
list_partners() |
list |
create_partner(input_body) |
Any |
update_partner(partner_id, patch) |
Any |
delete_partner(partner_id) |
None |
admin — platform-admin only
| Method |
Returns |
provision_workspace(*, account_id, partner, discount_rate, brand_name=None, business_email=None) |
PartnerWorkspace |
get_workspace(account_id) |
PartnerWorkspace |
partner_usage(*, partner, from_, to) |
PartnerUsageSummary |
Top-level helpers
from plugipay import verify_webhook
| Function |
Signature |
Returns |
verify_webhook |
(raw_body, signature_header, secret, *, tolerance_sec=300, now=None) |
WebhookEvent |
See Webhooks.
Exceptions
from plugipay import (
PlugipayError,
PlugipayNetworkError,
PlugipayTimeoutError,
PlugipaySignatureError,
)
| Exception |
When raised |
PlugipayError |
Base; any failure. Attributes: status, code, message, request_id. |
PlugipayNetworkError |
Transport failure (DNS, connect, TLS). status=0, code='network_error'. |
PlugipayTimeoutError |
Request exceeded timeout. status=0, code='timeout'. |
PlugipaySignatureError |
verify_webhook rejected the signature. status=401. |
See Errors.
Resource classes
Every resource method returns a dataclass that wraps the raw JSON dict. Useful for type hints and IDE autocompletion; runtime behaviour is identical to a dict.
from plugipay import (
AccountProfile, AdapterConfig, AdminPortalIdentity, ApiKey,
AvailableBalance, BankAccount, BillingTier, BrowserSession,
CashFlowReport, CheckoutSession, CheckoutSettings, Customer,
EventRecord, Invoice, LedgerBalance, LedgerEntry, LinkedAccount,
ManagedOnboardingState, PageResult, PartnerUsageSummary,
PartnerWorkspace, Payout, Plan, PnLReport, PortalSession,
ReceiptSummary, Refund, Resource, Subscription, Template,
UploadedFile, WebhookEndpoint, WebhookEvent, Workspace,
WorkspaceMember,
)
All inherit from Resource, which exposes:
obj.raw # dict — the full server payload
obj["field"] # KeyError if absent
obj.get("field") # None if absent
obj.get("field", default)
obj.to_dict() # round-trip the raw dict
Resource.from_dict(d) # classmethod constructor
PageResult[T] is the only non-Resource dataclass:
page: PageResult[Customer] = plug.customers.list()
page.data # list[Customer]
page.cursor # str | None
page.has_more # bool
Next