inttegro.refund
Models, requests, and enums for the Inttegro refund resource.
The primary returned object is inttegro.refund.Refund. Related request types, nested response shapes, and string-backed enums are exported from this singular namespace. Public members load lazily, so importing one resource does not eagerly import the entire SDK.
1"""Models, requests, and enums for the Inttegro refund resource. 2 3The primary returned object is ``inttegro.refund.Refund``. Related request types, nested response shapes, and string-backed enums are exported from this singular namespace. Public members load lazily, so importing one resource does not eagerly import the entire SDK.""" 4 5from importlib import import_module 6from typing import TYPE_CHECKING, Any 7 8if TYPE_CHECKING: 9 from .cancel_request import CancelRequest as CancelRequest 10 from .create_line_item_input import CreateLineItemInput as CreateLineItemInput 11 from .create_request import CreateRequest as CreateRequest 12 from .failure import Failure as Failure 13 from .failure_reason import FailureReason as FailureReason 14 from .line_item import LineItem as LineItem 15 from .lookup_request import LookupRequest as LookupRequest 16 from .offline_settlement import OfflineSettlement as OfflineSettlement 17 from .order_fee_line_item import OrderFeeLineItem as OrderFeeLineItem 18 from .order_fee_line_item_fee import OrderFeeLineItemFee as OrderFeeLineItemFee 19 from .order_line_item import OrderLineItem as OrderLineItem 20 from .order_product_line_item import OrderProductLineItem as OrderProductLineItem 21 from .order_product_line_item_product import OrderProductLineItemProduct as OrderProductLineItemProduct 22 from .order_shipping_line_item import OrderShippingLineItem as OrderShippingLineItem 23 from .order_shipping_line_item_shipping import OrderShippingLineItemShipping as OrderShippingLineItemShipping 24 from .page import Page as Page 25 from .page_request import PageRequest as PageRequest 26 from .page_response import PageResponse as PageResponse 27 from .payment_method_settlement import PaymentMethodSettlement as PaymentMethodSettlement 28 from .reason import Reason as Reason 29 from .reason_input import ReasonInput as ReasonInput 30 from .reason_value import ReasonValue as ReasonValue 31 from .refund import Refund as Refund 32 from .request_meta_input import RequestMetaInput as RequestMetaInput 33 from .response import Response as Response 34 from .settlement import Settlement as Settlement 35 from .settlement_bank_account import SettlementBankAccount as SettlementBankAccount 36 from .settlement_bank_account_payment_method import SettlementBankAccountPaymentMethod as SettlementBankAccountPaymentMethod 37 from .settlement_ghana_bank_account import SettlementGhanaBankAccount as SettlementGhanaBankAccount 38 from .settlement_mobile_money import SettlementMobileMoney as SettlementMobileMoney 39 from .settlement_mobile_money_payment_method import SettlementMobileMoneyPaymentMethod as SettlementMobileMoneyPaymentMethod 40 from .settlement_payment_method import SettlementPaymentMethod as SettlementPaymentMethod 41 from .status import Status as Status 42 43 44_EXPORTS: dict[str, tuple[str, str]] = { 45 "CancelRequest": ("inttegro.refund.cancel_request", "CancelRequest"), 46 "CreateLineItemInput": ("inttegro.refund.create_line_item_input", "CreateLineItemInput"), 47 "CreateRequest": ("inttegro.refund.create_request", "CreateRequest"), 48 "Failure": ("inttegro.refund.failure", "Failure"), 49 "FailureReason": ("inttegro.refund.failure_reason", "FailureReason"), 50 "LineItem": ("inttegro.refund.line_item", "LineItem"), 51 "LookupRequest": ("inttegro.refund.lookup_request", "LookupRequest"), 52 "OfflineSettlement": ("inttegro.refund.offline_settlement", "OfflineSettlement"), 53 "OrderFeeLineItem": ("inttegro.refund.order_fee_line_item", "OrderFeeLineItem"), 54 "OrderFeeLineItemFee": ("inttegro.refund.order_fee_line_item_fee", "OrderFeeLineItemFee"), 55 "OrderLineItem": ("inttegro.refund.order_line_item", "OrderLineItem"), 56 "OrderProductLineItem": ("inttegro.refund.order_product_line_item", "OrderProductLineItem"), 57 "OrderProductLineItemProduct": ("inttegro.refund.order_product_line_item_product", "OrderProductLineItemProduct"), 58 "OrderShippingLineItem": ("inttegro.refund.order_shipping_line_item", "OrderShippingLineItem"), 59 "OrderShippingLineItemShipping": ("inttegro.refund.order_shipping_line_item_shipping", "OrderShippingLineItemShipping"), 60 "Page": ("inttegro.refund.page", "Page"), 61 "PageRequest": ("inttegro.refund.page_request", "PageRequest"), 62 "PageResponse": ("inttegro.refund.page_response", "PageResponse"), 63 "PaymentMethodSettlement": ("inttegro.refund.payment_method_settlement", "PaymentMethodSettlement"), 64 "Reason": ("inttegro.refund.reason", "Reason"), 65 "ReasonInput": ("inttegro.refund.reason_input", "ReasonInput"), 66 "ReasonValue": ("inttegro.refund.reason_value", "ReasonValue"), 67 "Refund": ("inttegro.refund.refund", "Refund"), 68 "RequestMetaInput": ("inttegro.refund.request_meta_input", "RequestMetaInput"), 69 "Response": ("inttegro.refund.response", "Response"), 70 "Settlement": ("inttegro.refund.settlement", "Settlement"), 71 "SettlementBankAccount": ("inttegro.refund.settlement_bank_account", "SettlementBankAccount"), 72 "SettlementBankAccountPaymentMethod": ("inttegro.refund.settlement_bank_account_payment_method", "SettlementBankAccountPaymentMethod"), 73 "SettlementGhanaBankAccount": ("inttegro.refund.settlement_ghana_bank_account", "SettlementGhanaBankAccount"), 74 "SettlementMobileMoney": ("inttegro.refund.settlement_mobile_money", "SettlementMobileMoney"), 75 "SettlementMobileMoneyPaymentMethod": ("inttegro.refund.settlement_mobile_money_payment_method", "SettlementMobileMoneyPaymentMethod"), 76 "SettlementPaymentMethod": ("inttegro.refund.settlement_payment_method", "SettlementPaymentMethod"), 77 "Status": ("inttegro.refund.status", "Status"), 78} 79 80__all__ = [ 81 "CancelRequest", 82 "CreateLineItemInput", 83 "CreateRequest", 84 "Failure", 85 "FailureReason", 86 "LineItem", 87 "LookupRequest", 88 "OfflineSettlement", 89 "OrderFeeLineItem", 90 "OrderFeeLineItemFee", 91 "OrderLineItem", 92 "OrderProductLineItem", 93 "OrderProductLineItemProduct", 94 "OrderShippingLineItem", 95 "OrderShippingLineItemShipping", 96 "Page", 97 "PageRequest", 98 "PageResponse", 99 "PaymentMethodSettlement", 100 "Reason", 101 "ReasonInput", 102 "ReasonValue", 103 "Refund", 104 "RequestMetaInput", 105 "Response", 106 "Settlement", 107 "SettlementBankAccount", 108 "SettlementBankAccountPaymentMethod", 109 "SettlementGhanaBankAccount", 110 "SettlementMobileMoney", 111 "SettlementMobileMoneyPaymentMethod", 112 "SettlementPaymentMethod", 113 "Status", 114] 115 116 117def __getattr__(name: str) -> Any: 118 """Load a public resource type on first access.""" 119 try: 120 module_name, attribute_name = _EXPORTS[name] 121 except KeyError: 122 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None 123 value = getattr(import_module(module_name), attribute_name) 124 globals()[name] = value 125 return value
12@dataclass(frozen=True, slots=True, kw_only=True) 13class CancelRequest(ApiRequest): 14 """Parameters accepted by the cancel request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``CancelRefundRequest``. 21 """ 22 reason: str | UnsetType = field(default=UNSET) 23 """Optional explanation for canceling the refund. Leading and trailing whitespace is removed. Optional. Python type: ``str``; wire name: ``reason``; JSON type: string. Constraints: minimum length 1; maximum length 2048""" 24 request_meta: RefundRequestMetaInput | UnsetType = field(default=UNSET) 25 """The request meta associated with this cancel request. Optional. Python type: ``RefundRequestMetaInput``; wire name: ``request_meta``; JSON type: object (RefundRequestMeta)""" 26 refund_id: str 27 """Refund to cancel before processing begins. Required. Python type: ``str``; wire name: ``refund_id``; JSON type: string"""
Parameters accepted by the cancel request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: CancelRefundRequest.
Optional explanation for canceling the refund. Leading and trailing whitespace is removed. Optional. Python type: str; wire name: reason; JSON type: string. Constraints: minimum length 1; maximum length 2048
The request meta associated with this cancel request. Optional. Python type: RefundRequestMetaInput; wire name: request_meta; JSON type: object (RefundRequestMeta)
Refund to cancel before processing begins. Required. Python type: str; wire name: refund_id; JSON type: string
13@dataclass(frozen=True, slots=True, kw_only=True) 14class CreateLineItemInput(ApiRequest): 15 """Parameters accepted by the create line item input operation. 16 17 This is an immutable, keyword-only request object. ``to_dict()`` uses 18 the documented wire names, omits fields left as ``UNSET``, serializes 19 string-backed enums by value, and requires timezone-aware datetimes. 20 21 API contract schema: ``CreateRefundLineItemInput``. 22 """ 23 reason: RefundReasonInput | UnsetType = field(default=UNSET) 24 """The reason associated with this create line item input. Optional. Python type: ``RefundReasonInput``; wire name: ``reason``; JSON type: object (RefundReason)""" 25 reason_details: str | UnsetType = field(default=UNSET) 26 """Line-specific explanation. Requires a line-level reason; required when that reason is `custom`. Optional. Python type: ``str``; wire name: ``reason_details``; JSON type: string. Constraints: maximum length 2048""" 27 order_line_item_id: str 28 """Strong identifier for the paid order line item being refunded. Required. Python type: ``str``; wire name: ``order_line_item_id``; JSON type: string""" 29 refund_amount: AmountParams 30 """Monetary refund amount, represented by a currency and an integer minor-unit value. Required. Python type: ``AmountParams``; wire name: ``refund_amount``; JSON type: object (AmountParams)"""
Parameters accepted by the create line item input operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: CreateRefundLineItemInput.
The reason associated with this create line item input. Optional. Python type: RefundReasonInput; wire name: reason; JSON type: object (RefundReason)
Line-specific explanation. Requires a line-level reason; required when that reason is custom. Optional. Python type: str; wire name: reason_details; JSON type: string. Constraints: maximum length 2048
Strong identifier for the paid order line item being refunded. Required. Python type: str; wire name: order_line_item_id; JSON type: string
Monetary refund amount, represented by a currency and an integer minor-unit value. Required. Python type: AmountParams; wire name: refund_amount; JSON type: object (AmountParams)
12@dataclass(frozen=True, slots=True, kw_only=True) 13class CreateRequest(ApiRequest): 14 """Parameters accepted by the create request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``CreateRefundRequest``. 21 """ 22 custom_data: CustomData | UnsetType = field(default=UNSET) 23 """Merchant-defined string values attached to a resource. SDKs expose this as a semantic collection rather than a raw map. Optional. Python type: ``CustomData``; wire name: ``custom_data``; JSON type: object (CustomData)""" 24 reason_details: str | UnsetType = field(default=UNSET) 25 """Overall explanation. Required when `reason` is `custom`. Optional. Python type: ``str``; wire name: ``reason_details``; JSON type: string. Constraints: maximum length 2048""" 26 reference: str | UnsetType = field(default=UNSET) 27 """Your reconciliation reference. Optional. Python type: ``str``; wire name: ``reference``; JSON type: string. Constraints: maximum length 256""" 28 request_meta: RefundRequestMetaInput | UnsetType = field(default=UNSET) 29 """The request meta associated with this create request. Optional. Python type: ``RefundRequestMetaInput``; wire name: ``request_meta``; JSON type: object (RefundRequestMeta)""" 30 line_items: list[CreateRefundLineItemInput] 31 """The line items associated with this create request. Required. Python type: ``list[CreateRefundLineItemInput]``; wire name: ``line_items``; JSON type: array of object (CreateRefundLineItem) values. Constraints: minimum items 1; maximum items 64""" 32 order_id: str 33 """Paid order to refund. Required. Python type: ``str``; wire name: ``order_id``; JSON type: string""" 34 reason: RefundReasonInput 35 """The reason associated with this create request. Required. Python type: ``RefundReasonInput``; wire name: ``reason``; JSON type: object (RefundReason)"""
Parameters accepted by the create request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: CreateRefundRequest.
Merchant-defined string values attached to a resource. SDKs expose this as a semantic collection rather than a raw map. Optional. Python type: CustomData; wire name: custom_data; JSON type: object (CustomData)
Overall explanation. Required when reason is custom. Optional. Python type: str; wire name: reason_details; JSON type: string. Constraints: maximum length 2048
Your reconciliation reference. Optional. Python type: str; wire name: reference; JSON type: string. Constraints: maximum length 256
The request meta associated with this create request. Optional. Python type: RefundRequestMetaInput; wire name: request_meta; JSON type: object (RefundRequestMeta)
The line items associated with this create request. Required. Python type: list[CreateRefundLineItemInput]; wire name: line_items; JSON type: array of object (CreateRefundLineItem) values. Constraints: minimum items 1; maximum items 64
Paid order to refund. Required. Python type: str; wire name: order_id; JSON type: string
The reason associated with this create request. Required. Python type: RefundReasonInput; wire name: reason; JSON type: object (RefundReason)
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Failure(ApiModel): 14 """Sanitized terminal refund failure information.""" 15 16 detail: str = field(init=False) 17 """Safe merchant-facing explanation. Required. Python type: ``str``; wire name: ``detail``; JSON type: string""" 18 reason: RefundFailureReason = field(init=False) 19 """Stable caller-safe failure reason. Required. Python type: ``RefundFailureReason``; wire name: ``reason``; JSON type: string enum""" 20 retryable: bool = field(init=False) 21 """Whether the underlying condition may be resolved. Required. Python type: ``bool``; wire name: ``retryable``; JSON type: boolean"""
Sanitized terminal refund failure information.
Safe merchant-facing explanation. Required. Python type: str; wire name: detail; JSON type: string
Stable caller-safe failure reason. Required. Python type: RefundFailureReason; wire name: reason; JSON type: string enum
Whether the underlying condition may be resolved. Required. Python type: bool; wire name: retryable; JSON type: boolean
11class FailureReason(WireEnum): 12 """Stable, caller-safe reason that terminal refund processing failed.""" 13 14 INSUFFICIENT_BALANCE = "insufficient_balance" 15 """Wire value ``insufficient_balance``""" 16 ORIGINAL_PAYMENT_METHOD_UNAVAILABLE = "original_payment_method_unavailable" 17 """Wire value ``original_payment_method_unavailable``""" 18 ORIGINAL_PAYMENT_NOT_REFUNDABLE = "original_payment_not_refundable" 19 """Wire value ``original_payment_not_refundable``""" 20 REFUND_NOT_SUPPORTED = "refund_not_supported" 21 """Wire value ``refund_not_supported``""" 22 AMOUNT_NOT_SUPPORTED = "amount_not_supported" 23 """Wire value ``amount_not_supported``""" 24 REFUND_DECLINED = "refund_declined" 25 """Wire value ``refund_declined``""" 26 REFUND_NOT_PERMITTED = "refund_not_permitted" 27 """Wire value ``refund_not_permitted``""" 28 TEMPORARILY_UNAVAILABLE = "temporarily_unavailable" 29 """Wire value ``temporarily_unavailable``""" 30 UNKNOWN = "unknown" 31 """Wire value ``unknown``"""
Stable, caller-safe reason that terminal refund processing failed.
Wire value insufficient_balance
Wire value original_payment_method_unavailable
Wire value original_payment_not_refundable
Wire value refund_not_supported
Wire value amount_not_supported
Wire value refund_not_permitted
Wire value temporarily_unavailable
13@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 14class LineItem(ApiModel): 15 """Typed line item data in the refund resource namespace. 16 17 Instances are immutable API responses. ``from_dict()`` decodes nested 18 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 19 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 20 Fields not returned by the API remain absent and can still be queried 21 through mapping-style access. 22 23 API contract schema: ``RefundLineItem``. 24 """ 25 id: str = field(init=False) 26 """Server-generated refund line-item identifier. Required. Python type: ``str``; wire name: ``id``; JSON type: string""" 27 order_line_item_id: str = field(init=False) 28 """Deprecated compatibility identifier. Use ``order_line_item.id`` when available. Required. Python type: ``str``; wire name: ``order_line_item_id``; JSON type: string""" 29 order_line_item: RefundOrderLineItem | None = field(init=False) 30 """Immutable display snapshot of the refunded order line. Optional; nullable. Python type: ``RefundOrderLineItem | None``; wire name: ``order_line_item``; JSON type: object (RefundOrderLineItem)""" 31 original_amount_paid: Amount = field(init=False) 32 """Monetary original amount paid, represented by a currency and an integer minor-unit value. Required. Python type: ``Amount``; wire name: ``original_amount_paid``; JSON type: object (Amount)""" 33 reason: RefundReasonValue | None = field(init=False) 34 """The reason associated with this line item. Optional; nullable. Python type: ``RefundReasonValue | None``; wire name: ``reason``; JSON type: object (RefundReason)""" 35 reason_details: str | None = field(init=False) 36 """The reason details associated with this line item. Optional; nullable. Python type: ``str | None``; wire name: ``reason_details``; JSON type: string. Constraints: maximum length 2048""" 37 refund_amount: Amount = field(init=False) 38 """Monetary refund amount, represented by a currency and an integer minor-unit value. Required. Python type: ``Amount``; wire name: ``refund_amount``; JSON type: object (Amount)"""
Typed line item data in the refund resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: RefundLineItem.
Server-generated refund line-item identifier. Required. Python type: str; wire name: id; JSON type: string
Deprecated compatibility identifier. Use order_line_item.id when available. Required. Python type: str; wire name: order_line_item_id; JSON type: string
Immutable display snapshot of the refunded order line. Optional; nullable. Python type: RefundOrderLineItem | None; wire name: order_line_item; JSON type: object (RefundOrderLineItem)
Monetary original amount paid, represented by a currency and an integer minor-unit value. Required. Python type: Amount; wire name: original_amount_paid; JSON type: object (Amount)
The reason associated with this line item. Optional; nullable. Python type: RefundReasonValue | None; wire name: reason; JSON type: object (RefundReason)
The reason details associated with this line item. Optional; nullable. Python type: str | None; wire name: reason_details; JSON type: string. Constraints: maximum length 2048
Monetary refund amount, represented by a currency and an integer minor-unit value. Required. Python type: Amount; wire name: refund_amount; JSON type: object (Amount)
12@dataclass(frozen=True, slots=True, kw_only=True) 13class LookupRequest(ApiRequest): 14 """Parameters accepted by the lookup request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``LookupRefundRequest``. 21 """ 22 refund_id: str 23 """Refund identifier to retrieve. Required. Python type: ``str``; wire name: ``refund_id``; JSON type: string"""
Parameters accepted by the lookup request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: LookupRefundRequest.
Refund identifier to retrieve. Required. Python type: str; wire name: refund_id; JSON type: string
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class OfflineSettlement(ApiModel): 13 """A refund for an order paid outside Inttegro.""" 14 15 type: Literal["offline"] = field(init=False) 16 """Settlement discriminator. Required; always ``offline``.""" 17 18 _strict_wire_shape = True
A refund for an order paid outside Inttegro.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class OrderFeeLineItem(ApiModel): 14 """Immutable fee line captured from the originating order.""" 15 16 id: str = field(init=False) 17 type: Literal["fee"] = field(init=False) 18 fee: OrderFeeLineItemFee = field(init=False)
Immutable fee line captured from the originating order.
10@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 11class OrderFeeLineItemFee(ApiModel): 12 """Descriptive fee fields captured by the order.""" 13 14 label: str | None = field(init=False) 15 description: str | None = field(init=False)
Descriptive fee fields captured by the order.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class OrderProductLineItem(ApiModel): 14 """Immutable product line captured from the originating order.""" 15 16 id: str = field(init=False) 17 type: Literal["product"] = field(init=False) 18 quantity: int = field(init=False) 19 product: OrderProductLineItemProduct = field(init=False)
Immutable product line captured from the originating order.
10@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 11class OrderProductLineItemProduct(ApiModel): 12 """Catalog or inline product identity captured by the order.""" 13 14 id: str | None = field(init=False) 15 name: str = field(init=False)
Catalog or inline product identity captured by the order.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class OrderShippingLineItem(ApiModel): 14 """Immutable shipping line captured from the originating order.""" 15 16 id: str = field(init=False) 17 type: Literal["shipping"] = field(init=False) 18 shipping: OrderShippingLineItemShipping = field(init=False)
Immutable shipping line captured from the originating order.
10@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 11class OrderShippingLineItemShipping(ApiModel): 12 """Descriptive shipping fields captured by the order.""" 13 14 label: str | None = field(init=False) 15 description: str | None = field(init=False)
Descriptive shipping fields captured by the order.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Page(ApiModel): 14 """One page of page resources. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``RefundPage``. 23 """ 24 number: int = field(init=False) 25 """Human-readable number assigned to the page. Required. Python type: ``int``; wire name: ``number``; JSON type: integer. Constraints: minimum 1""" 26 refunds: list[Refund] = field(init=False) 27 """The refunds associated with this page. Required. Python type: ``list[Refund]``; wire name: ``refunds``; JSON type: array of object (Refund) values""" 28 size: int = field(init=False) 29 """Number of refunds returned in this page. Required. Python type: ``int``; wire name: ``size``; JSON type: integer. Constraints: minimum 0"""
One page of page resources.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: RefundPage.
Human-readable number assigned to the page. Required. Python type: int; wire name: number; JSON type: integer. Constraints: minimum 1
The refunds associated with this page. Required. Python type: list[Refund]; wire name: refunds; JSON type: array of object (Refund) values
Number of refunds returned in this page. Required. Python type: int; wire name: size; JSON type: integer. Constraints: minimum 0
12@dataclass(frozen=True, slots=True, kw_only=True) 13class PageRequest(ApiRequest): 14 """Parameters accepted by the page request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``PageRefundsRequest``. 21 """ 22 page_size: int | UnsetType = field(default=UNSET) 23 """Maximum number of refunds to return. Optional. Python type: ``int``; wire name: ``page_size``; JSON type: integer. Constraints: minimum 1; maximum 256""" 24 page_number: int 25 """One-based page number. Required. Python type: ``int``; wire name: ``page_number``; JSON type: integer. Constraints: minimum 1; maximum 10"""
Parameters accepted by the page request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: PageRefundsRequest.
Maximum number of refunds to return. Optional. Python type: int; wire name: page_size; JSON type: integer. Constraints: minimum 1; maximum 256
One-based page number. Required. Python type: int; wire name: page_number; JSON type: integer. Constraints: minimum 1; maximum 10
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class PageResponse(ApiModel): 14 """Typed response returned by the page operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``RefundPageResponse``. 23 """ 24 page: RefundPage = field(init=False) 25 """Numeric page used by this operation. Required. Python type: ``RefundPage``; wire name: ``page``; JSON type: object (RefundPage)"""
Typed response returned by the page operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: RefundPageResponse.
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class PaymentMethodSettlement(ApiModel): 13 """A refund returned to the original payment method.""" 14 15 type: Literal["payment_method"] = field(init=False) 16 """Settlement discriminator. Required; always ``payment_method``.""" 17 payment_method: SettlementPaymentMethod = field(init=False) 18 """Caller-safe immutable snapshot of the original payment method.""" 19 20 _strict_wire_shape = True
A refund returned to the original payment method.
Caller-safe immutable snapshot of the original payment method.
11class Reason(WireEnum): 12 """Typed reason data in the refund resource namespace. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``RefundReason``. 18 """ 19 REQUESTED_BY_CUSTOMER = "requested_by_customer" 20 """Wire value ``requested_by_customer`` (requested by customer)""" 21 DUPLICATE = "duplicate" 22 """Wire value ``duplicate`` (duplicate)""" 23 FRAUDULENT = "fraudulent" 24 """Wire value ``fraudulent`` (fraudulent)""" 25 ORDER_CANCELED = "order_canceled" 26 """Wire value ``order_canceled`` (order canceled)""" 27 ITEM_RETURNED = "item_returned" 28 """Wire value ``item_returned`` (item returned)""" 29 ITEM_DAMAGED = "item_damaged" 30 """Wire value ``item_damaged`` (item damaged)""" 31 ITEM_NOT_RECEIVED = "item_not_received" 32 """Wire value ``item_not_received`` (item not received)""" 33 ITEM_NOT_AS_DESCRIBED = "item_not_as_described" 34 """Wire value ``item_not_as_described`` (item not as described)""" 35 CUSTOM = "custom" 36 """Wire value ``custom`` (custom)"""
Typed reason data in the refund resource namespace.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: RefundReason.
Wire value requested_by_customer (requested by customer)
Wire value order_canceled (order canceled)
Wire value item_not_received (item not received)
Wire value item_not_as_described (item not as described)
15@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 16class Refund(ApiModel): 17 """Typed refund data in the refund resource namespace. 18 19 Instances are immutable API responses. ``from_dict()`` decodes nested 20 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 21 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 22 Fields not returned by the API remain absent and can still be queried 23 through mapping-style access. 24 """ 25 cancel_reason: str | None = field(init=False) 26 """Omitted unless a reason was supplied when the refund was canceled. Optional; nullable. Python type: ``str | None``; wire name: ``cancel_reason``; JSON type: string""" 27 canceled_at: datetime | None = field(init=False) 28 """Omitted unless the refund was canceled before processing began. Optional; nullable. Python type: ``datetime | None``; wire name: ``canceled_at``; JSON type: string (date-time)""" 29 created_at: datetime = field(init=False) 30 """When the refund was created. Required. Python type: ``datetime``; wire name: ``created_at``; JSON type: string (date-time)""" 31 custom_data: CustomData | None = field(init=False) 32 """Merchant-defined string values attached to a resource. SDKs expose this as a semantic collection rather than a raw map. Optional; nullable. Python type: ``CustomData | None``; wire name: ``custom_data``; JSON type: object (CustomData)""" 33 failed_at: datetime | None = field(init=False) 34 """Omitted unless processing failed. Optional; nullable. Python type: ``datetime | None``; wire name: ``failed_at``; JSON type: string (date-time)""" 35 failure: RefundFailure | None = field(init=False) 36 """Sanitized terminal failure information. Optional; nullable. Python type: ``RefundFailure | None``; wire name: ``failure``; JSON type: object (RefundFailure)""" 37 id: str = field(init=False) 38 """Unique identifier for this refund. Required. Python type: ``str``; wire name: ``id``; JSON type: string""" 39 line_items: list[RefundLineItem] = field(init=False) 40 """One or more immutable line-level refund allocations. Required. Python type: ``list[RefundLineItem]``; wire name: ``line_items``; JSON type: array of object (RefundLineItem) values""" 41 order_id: str = field(init=False) 42 """Identifier of the related order. Required. Python type: ``str``; wire name: ``order_id``; JSON type: string""" 43 order_amount: Amount | None = field(init=False) 44 """Total amount of the originating order captured when the refund was created. Optional; nullable. Python type: ``Amount | None``; wire name: ``order_amount``; JSON type: object (Amount)""" 45 processing_at: datetime | None = field(init=False) 46 """Omitted until processing starts. Optional; nullable. Python type: ``datetime | None``; wire name: ``processing_at``; JSON type: string (date-time)""" 47 reason: RefundReasonValue = field(init=False) 48 """The reason associated with this refund. Required. Python type: ``RefundReasonValue``; wire name: ``reason``; JSON type: object (RefundReason)""" 49 reason_details: str | None = field(init=False) 50 """The reason details associated with this refund. Optional; nullable. Python type: ``str | None``; wire name: ``reason_details``; JSON type: string. Constraints: maximum length 2048""" 51 reference: str | None = field(init=False) 52 """Merchant-defined external reference for the refund. Optional; nullable. Python type: ``str | None``; wire name: ``reference``; JSON type: string""" 53 settlement: RefundSettlement = field(init=False) 54 """Immutable refund destination. Required. Python type: ``RefundSettlement``; wire name: ``settlement``; JSON type: object (RefundSettlement) selected by the required ``type`` discriminator""" 55 status: Literal['canceled', 'failed', 'pending', 'processing', 'succeeded'] = field(init=False) 56 """Current lifecycle status of the refund. Required. Python type: ``Literal['canceled', 'failed', 'pending', 'processing', 'succeeded']``; wire name: ``status``; JSON type: string. Constraints: allowed values ``canceled``, ``failed``, ``pending``, ``processing``, ``succeeded``""" 57 succeeded_at: datetime | None = field(init=False) 58 """Omitted unless processing succeeded. Optional; nullable. Python type: ``datetime | None``; wire name: ``succeeded_at``; JSON type: string (date-time)""" 59 total: Amount = field(init=False) 60 """Monetary total, represented by a currency and an integer minor-unit value. Required. Python type: ``Amount``; wire name: ``total``; JSON type: object (Amount)"""
Typed refund data in the refund resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
Omitted unless a reason was supplied when the refund was canceled. Optional; nullable. Python type: str | None; wire name: cancel_reason; JSON type: string
Omitted unless the refund was canceled before processing began. Optional; nullable. Python type: datetime | None; wire name: canceled_at; JSON type: string (date-time)
When the refund was created. Required. Python type: datetime; wire name: created_at; JSON type: string (date-time)
Merchant-defined string values attached to a resource. SDKs expose this as a semantic collection rather than a raw map. Optional; nullable. Python type: CustomData | None; wire name: custom_data; JSON type: object (CustomData)
Omitted unless processing failed. Optional; nullable. Python type: datetime | None; wire name: failed_at; JSON type: string (date-time)
Sanitized terminal failure information. Optional; nullable. Python type: RefundFailure | None; wire name: failure; JSON type: object (RefundFailure)
Unique identifier for this refund. Required. Python type: str; wire name: id; JSON type: string
One or more immutable line-level refund allocations. Required. Python type: list[RefundLineItem]; wire name: line_items; JSON type: array of object (RefundLineItem) values
Identifier of the related order. Required. Python type: str; wire name: order_id; JSON type: string
Total amount of the originating order captured when the refund was created. Optional; nullable. Python type: Amount | None; wire name: order_amount; JSON type: object (Amount)
Omitted until processing starts. Optional; nullable. Python type: datetime | None; wire name: processing_at; JSON type: string (date-time)
The reason associated with this refund. Required. Python type: RefundReasonValue; wire name: reason; JSON type: object (RefundReason)
The reason details associated with this refund. Optional; nullable. Python type: str | None; wire name: reason_details; JSON type: string. Constraints: maximum length 2048
Merchant-defined external reference for the refund. Optional; nullable. Python type: str | None; wire name: reference; JSON type: string
Immutable refund destination. Required. Python type: RefundSettlement; wire name: settlement; JSON type: object (RefundSettlement) selected by the required type discriminator
Current lifecycle status of the refund. Required. Python type: Literal['canceled', 'failed', 'pending', 'processing', 'succeeded']; wire name: status; JSON type: string. Constraints: allowed values canceled, failed, pending, processing, succeeded
Omitted unless processing succeeded. Optional; nullable. Python type: datetime | None; wire name: succeeded_at; JSON type: string (date-time)
Monetary total, represented by a currency and an integer minor-unit value. Required. Python type: Amount; wire name: total; JSON type: object (Amount)
13@dataclass(frozen=True, slots=True, kw_only=True) 14class RequestMetaInput(ApiRequest): 15 """Parameters accepted by the request meta input operation. 16 17 This is an immutable, keyword-only request object. ``to_dict()`` uses 18 the documented wire names, omits fields left as ``UNSET``, serializes 19 string-backed enums by value, and requires timezone-aware datetimes. 20 21 API contract schema: ``RefundRequestMetaInput``. 22 """ 23 idempotency_key: str | UnsetType = field(default=UNSET) 24 """Stable retry key carried inside ``request_meta``. It must match the ``Idempotency-Key`` header when both are provided. Optional. Python type: ``str``; wire name: ``idempotency_key``; JSON type: string. Constraints: minimum length 1; maximum length 255""" 25 response: Response | UnsetType = field(default=UNSET) 26 """Optional typed selection of public response properties. Python type: ``Response``; wire name: ``response``; JSON type: object (RequestResponse)"""
Parameters accepted by the request meta input operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: RefundRequestMetaInput.
Stable retry key carried inside request_meta. It must match the Idempotency-Key header when both are provided. Optional. Python type: str; wire name: idempotency_key; JSON type: string. Constraints: minimum length 1; maximum length 255
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Response(ApiModel): 14 """Typed response returned by the response operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``RefundResponse``. 23 """ 24 refund: Refund = field(init=False) 25 """The refund associated with this response. Required. Python type: ``Refund``; wire name: ``refund``; JSON type: object (Refund)"""
Typed response returned by the response operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: RefundResponse.
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class SettlementBankAccount(ApiModel): 13 """Supported bank-account subtype and its masked details.""" 14 15 type: Literal["ghana_bank_account"] = field(init=False) 16 ghana_bank_account: SettlementGhanaBankAccount = field(init=False) 17 18 _strict_wire_shape = True
Supported bank-account subtype and its masked details.
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class SettlementBankAccountPaymentMethod(ApiModel): 13 """Safe snapshot of the original bank-account method.""" 14 15 id: str = field(init=False) 16 """Public payment-method identifier.""" 17 type: Literal["bank_account"] = field(init=False) 18 """Payment-method discriminator. Required; always ``bank_account``.""" 19 bank_account: SettlementBankAccount = field(init=False) 20 """Masked bank-account recognition details.""" 21 22 _strict_wire_shape = True
Safe snapshot of the original bank-account method.
10@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 11class SettlementGhanaBankAccount(ApiModel): 12 """Masked bank details; no raw account value is exposed.""" 13 14 account_number: str = field(init=False) 15 """Masked account in ``****1234`` form.""" 16 last4: str = field(init=False) 17 """Final four numeric digits.""" 18 19 _strict_wire_shape = True
Masked bank details; no raw account value is exposed.
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class SettlementMobileMoney(ApiModel): 13 """Masked mobile-money details; no raw account value is exposed.""" 14 15 network: Literal["airtel", "mtn", "telecel", "vodafone"] = field(init=False) 16 account_number: str = field(init=False) 17 """Masked account in ``****1234`` form.""" 18 last4: str = field(init=False) 19 """Final four numeric digits.""" 20 21 _strict_wire_shape = True
Masked mobile-money details; no raw account value is exposed.
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class SettlementMobileMoneyPaymentMethod(ApiModel): 13 """Safe snapshot of the original mobile-money method.""" 14 15 id: str = field(init=False) 16 """Public payment-method identifier.""" 17 type: Literal["mobile_money"] = field(init=False) 18 """Payment-method discriminator. Required; always ``mobile_money``.""" 19 mobile_money: SettlementMobileMoney = field(init=False) 20 """Masked mobile-money recognition details.""" 21 22 _strict_wire_shape = True
Safe snapshot of the original mobile-money method.
11class Status(WireEnum): 12 """Typed status data in the refund resource namespace. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``RefundStatus``. 18 """ 19 CANCELED = "canceled" 20 """Wire value ``canceled`` (canceled)""" 21 FAILED = "failed" 22 """Wire value ``failed`` (failed)""" 23 PENDING = "pending" 24 """Wire value ``pending`` (pending)""" 25 PROCESSING = "processing" 26 """Wire value ``processing`` (processing)""" 27 SUCCEEDED = "succeeded" 28 """Wire value ``succeeded`` (succeeded)"""
Typed status data in the refund resource namespace.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: RefundStatus.