derp.payments – Payments¶
Payments client and typed models.
- class derp.payments.PaymentsClient[source]¶
Bases:
objectAsync wrapper around Stripe payments APIs.
- __init__(config)[source]¶
- Parameters:
config (PaymentsConfig)
- async create_customer(*, email=None, name=None, phone=None, metadata=None)[source]¶
Create a Stripe customer.
- async update_customer(customer_id, *, email=None, name=None, phone=None, metadata=None)[source]¶
Update a Stripe customer.
- async create_checkout_session(*, mode, success_url, cancel_url, line_items, customer_id=None, customer_email=None, client_reference_id=None, metadata=None, allow_promotion_codes=None, idempotency_key=None)[source]¶
Create a Stripe checkout session.
- Parameters:
- Return type:
- async retrieve_checkout_session(session_id, *, expand=None)[source]¶
Retrieve a Stripe checkout session.
- Parameters:
- Return type:
- async expire_checkout_session(session_id)[source]¶
Expire a Stripe checkout session.
- Parameters:
session_id (str)
- Return type:
- async list_customers(*, limit=25, starting_after=None)[source]¶
List Stripe customers.
- Parameters:
- Return type:
- async list_products(*, limit=25, starting_after=None)[source]¶
List Stripe products with expanded default price.
- Parameters:
- Return type:
- async list_subscriptions(*, limit=25, starting_after=None)[source]¶
List Stripe subscriptions across all statuses.
- Parameters:
- Return type:
- async list_invoices(*, limit=25, starting_after=None)[source]¶
List Stripe invoices.
- Parameters:
- Return type:
- async list_charges(*, limit=25, starting_after=None)[source]¶
List Stripe charges.
- Parameters:
- Return type:
- async create_account(*, type=None, country=None, email=None, metadata=None, capabilities=None, business_type=None, business_profile=None)[source]¶
Create a Stripe Connect account.
- async update_account(account_id, *, metadata=None, business_profile=None)[source]¶
Update a Stripe Connect account.
- async create_account_link(*, account_id, refresh_url, return_url, type)[source]¶
Create a Stripe account onboarding or update link.
- Parameters:
account_id (str)
refresh_url (str)
return_url (str)
type (AccountLinkType | str)
- Return type:
- async list_accounts(*, limit=25, starting_after=None)[source]¶
List Stripe Connect accounts.
- Parameters:
- Return type:
- async create_transfer(*, amount, currency, destination, description=None, metadata=None, transfer_group=None)[source]¶
Create a Stripe transfer to a connected account.
- async list_transfers(*, limit=25, starting_after=None, destination=None, transfer_group=None)[source]¶
List Stripe transfers.
- Parameters:
- Return type:
- async create_payment_intent(*, amount, currency, customer_id=None, metadata=None, description=None, payment_method_types=None, capture_method=None, transfer_data=None, application_fee_amount=None, on_behalf_of=None)[source]¶
Create a Stripe payment intent.
- Parameters:
- Return type:
- async retrieve_payment_intent(payment_intent_id, *, expand=None)[source]¶
Retrieve a Stripe payment intent.
- Parameters:
- Return type:
- async confirm_payment_intent(payment_intent_id, *, payment_method=None)[source]¶
Confirm a Stripe payment intent.
- Parameters:
- Return type:
- async capture_payment_intent(payment_intent_id, *, amount_to_capture=None)[source]¶
Capture an authorized Stripe payment intent.
- Parameters:
- Return type:
- async cancel_payment_intent(payment_intent_id, *, cancellation_reason=None)[source]¶
Cancel a Stripe payment intent.
- Parameters:
payment_intent_id (str)
cancellation_reason (CancellationReason | str | None)
- Return type:
- async list_payment_intents(*, limit=25, starting_after=None, customer_id=None)[source]¶
List Stripe payment intents.
- Parameters:
- Return type:
- async create_refund(*, payment_intent_id=None, charge_id=None, amount=None, reason=None, metadata=None, reverse_transfer=None, refund_application_fee=None)[source]¶
Create a Stripe refund.
- async list_refunds(*, limit=25, starting_after=None, payment_intent_id=None, charge_id=None)[source]¶
List Stripe refunds.
- Parameters:
- Return type:
- async create_payout(*, amount, currency, description=None, metadata=None, destination=None, method=None, stripe_account=None)[source]¶
Create a Stripe payout.
- async list_payouts(*, limit=25, starting_after=None, stripe_account=None)[source]¶
List Stripe payouts.
- Parameters:
- Return type:
- class derp.payments.PaymentsConfig[source]¶
Bases:
_StrictModelPayments configuration.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- exception derp.payments.PaymentsError[source]¶
Bases:
ExceptionBase exception for all payments errors.
- exception derp.payments.PaymentsProviderError[source]¶
Bases:
PaymentsErrorRaised when Stripe returns an error.
- exception derp.payments.PaymentsNotConnectedError[source]¶
Bases:
PaymentsErrorRaised when payments client is used before connect().
- exception derp.payments.WebhookSignatureError[source]¶
Bases:
PaymentsErrorRaised when webhook verification fails.
- class derp.payments.AccountType[source]¶
Bases:
StrEnumStripe Connect account type.
- STANDARD = 'standard'¶
- EXPRESS = 'express'¶
- CUSTOM = 'custom'¶
- __new__(value)¶
- class derp.payments.AccountLinkType[source]¶
Bases:
StrEnumStripe account link type.
- ACCOUNT_ONBOARDING = 'account_onboarding'¶
- ACCOUNT_UPDATE = 'account_update'¶
- __new__(value)¶
- class derp.payments.CaptureMethod[source]¶
Bases:
StrEnumPayment intent capture method.
- AUTOMATIC = 'automatic'¶
- AUTOMATIC_ASYNC = 'automatic_async'¶
- MANUAL = 'manual'¶
- __new__(value)¶
- class derp.payments.CancellationReason[source]¶
Bases:
StrEnumPayment intent cancellation reason.
- DUPLICATE = 'duplicate'¶
- FRAUDULENT = 'fraudulent'¶
- REQUESTED_BY_CUSTOMER = 'requested_by_customer'¶
- ABANDONED = 'abandoned'¶
- __new__(value)¶
- class derp.payments.RefundReason[source]¶
Bases:
StrEnumRefund reason.
- DUPLICATE = 'duplicate'¶
- FRAUDULENT = 'fraudulent'¶
- REQUESTED_BY_CUSTOMER = 'requested_by_customer'¶
- __new__(value)¶
- class derp.payments.PayoutMethod[source]¶
Bases:
StrEnumPayout method.
- STANDARD = 'standard'¶
- INSTANT = 'instant'¶
- __new__(value)¶
- class derp.payments.CheckoutSessionMode[source]¶
Bases:
StrEnumStripe checkout session mode.
- PAYMENT = 'payment'¶
- SUBSCRIPTION = 'subscription'¶
- __new__(value)¶
- class derp.payments.CheckoutSession[source]¶
Bases:
objectNormalized Stripe checkout session payload.
- mode: CheckoutSessionMode | None¶
- __init__(id, url, mode, customer_id, customer_email, payment_status, status, expires_at, raw)¶
- class derp.payments.Account[source]¶
Bases:
objectNormalized Stripe Connect account.
- __init__(id, type, email, country, charges_enabled, payouts_enabled, details_submitted, business_type, metadata, created, raw)¶
- class derp.payments.Transfer[source]¶
Bases:
objectNormalized Stripe transfer.
- __init__(id, amount, currency, destination, description, transfer_group, metadata, created, raw)¶
- class derp.payments.PaymentIntent[source]¶
Bases:
objectNormalized Stripe payment intent.
- __init__(id, amount, currency, status, customer_id, description, capture_method, cancellation_reason, payment_method, metadata, created, raw)¶
- class derp.payments.Refund[source]¶
Bases:
objectNormalized Stripe refund.
- __init__(id, amount, currency, status, payment_intent_id, charge_id, reason, metadata, created, raw)¶
- class derp.payments.Payout[source]¶
Bases:
objectNormalized Stripe payout.
- __init__(id, amount, currency, status, method, description, destination, metadata, arrival_date, created, raw)¶