# Experimental # Payment Flows ## Create `experimental.payment_flows.create(PaymentFlowCreateParams**kwargs) -> PaymentFlowCreateResponse` **post** `/payment-flows` Creates a new payment flow. ### Parameters - `external_id: str` User-provided unique external ID. - `invoice: Invoice` Invoice to settle. - `class InvoiceID: …` - `id: str` Fragment invoice ID. - `class InvoiceExternalID: …` - `external_id: str` Invoice external ID. - `type: Literal["single_invoice_settlement"]` Type of payment flow. - `"single_invoice_settlement"` ### Returns - `class PaymentFlowCreateResponse: …` - `data: PaymentFlow` Payment flow object. - `id: str` FRAGMENT generated unique ID. - `created: str` Timestamp when the payment flow was created. - `external_id: str` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: str` Invoice identifier. - `external_id: Optional[str]` Invoice external ID. - `modified: str` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: List[PaymentPlanBatch]` Payment batches. - `batch_id: str` Batch identifier. - `depends_on: List[str]` Batches this one depends on. - `label: str` Human-readable batch label. - `payments: List[PaymentPlanBatchPayment]` Payments in this batch. - `amount: str` Amount in smallest currency unit. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `payment_id: str` FRAGMENT generated unique ID. - `status: str` Status of the payment. - `user: PaymentPlanBatchPaymentUser` User associated with the payment. - `id: str` FRAGMENT generated unique ID. - `external_id: str` User-provided unique ID. - `status: str` Batch status. - `generated_at: str` When the plan was generated. - `invoice_id: str` Invoice identifier. - `version: float` Plan version. - `status: str` Status of the payment flow. - `type: str` Type of payment flow. ### Example ```python from fragment import Fragment client = Fragment() payment_flow = client.experimental.payment_flows.create( external_id="pf_123", invoice={ "id": "inv_abc123" }, type="single_invoice_settlement", ) print(payment_flow.data) ``` ## Retrieve `experimental.payment_flows.retrieve(strpayment_flow_ref) -> PaymentFlowRetrieveResponse` **get** `/payment-flows/{payment_flow_ref}` Gets a payment flow by ID or external ID. ### Parameters - `payment_flow_ref: str` Payment flow ID or external ID. ### Returns - `class PaymentFlowRetrieveResponse: …` - `data: PaymentFlow` Payment flow object. - `id: str` FRAGMENT generated unique ID. - `created: str` Timestamp when the payment flow was created. - `external_id: str` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: str` Invoice identifier. - `external_id: Optional[str]` Invoice external ID. - `modified: str` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: List[PaymentPlanBatch]` Payment batches. - `batch_id: str` Batch identifier. - `depends_on: List[str]` Batches this one depends on. - `label: str` Human-readable batch label. - `payments: List[PaymentPlanBatchPayment]` Payments in this batch. - `amount: str` Amount in smallest currency unit. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `payment_id: str` FRAGMENT generated unique ID. - `status: str` Status of the payment. - `user: PaymentPlanBatchPaymentUser` User associated with the payment. - `id: str` FRAGMENT generated unique ID. - `external_id: str` User-provided unique ID. - `status: str` Batch status. - `generated_at: str` When the plan was generated. - `invoice_id: str` Invoice identifier. - `version: float` Plan version. - `status: str` Status of the payment flow. - `type: str` Type of payment flow. ### Example ```python from fragment import Fragment client = Fragment() payment_flow = client.experimental.payment_flows.retrieve( "pf_abc123", ) print(payment_flow.data) ``` ## Search `experimental.payment_flows.search(PaymentFlowSearchParams**kwargs) -> PaymentFlowSearchResponse` **post** `/payment-flows/search` Searches payment flows. ### Parameters - `invoice_id: Optional[str]` Filter by invoice ID. - `page_info: Optional[PageInfo]` Pagination parameters. - `after: Optional[str]` Pagination cursor. - `limit: Optional[float]` Maximum number of results. ### Returns - `class PaymentFlowSearchResponse: …` List of payment flows. - `data: List[PaymentFlow]` - `id: str` FRAGMENT generated unique ID. - `created: str` Timestamp when the payment flow was created. - `external_id: str` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: str` Invoice identifier. - `external_id: Optional[str]` Invoice external ID. - `modified: str` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: List[PaymentPlanBatch]` Payment batches. - `batch_id: str` Batch identifier. - `depends_on: List[str]` Batches this one depends on. - `label: str` Human-readable batch label. - `payments: List[PaymentPlanBatchPayment]` Payments in this batch. - `amount: str` Amount in smallest currency unit. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `payment_id: str` FRAGMENT generated unique ID. - `status: str` Status of the payment. - `user: PaymentPlanBatchPaymentUser` User associated with the payment. - `id: str` FRAGMENT generated unique ID. - `external_id: str` User-provided unique ID. - `status: str` Batch status. - `generated_at: str` When the plan was generated. - `invoice_id: str` Invoice identifier. - `version: float` Plan version. - `status: str` Status of the payment flow. - `type: str` Type of payment flow. ### Example ```python from fragment import Fragment client = Fragment() response = client.experimental.payment_flows.search() print(response.data) ``` ## Domain Types ### Payment Flow - `class PaymentFlow: …` Payment flow object. - `id: str` FRAGMENT generated unique ID. - `created: str` Timestamp when the payment flow was created. - `external_id: str` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: str` Invoice identifier. - `external_id: Optional[str]` Invoice external ID. - `modified: str` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: List[PaymentPlanBatch]` Payment batches. - `batch_id: str` Batch identifier. - `depends_on: List[str]` Batches this one depends on. - `label: str` Human-readable batch label. - `payments: List[PaymentPlanBatchPayment]` Payments in this batch. - `amount: str` Amount in smallest currency unit. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `payment_id: str` FRAGMENT generated unique ID. - `status: str` Status of the payment. - `user: PaymentPlanBatchPaymentUser` User associated with the payment. - `id: str` FRAGMENT generated unique ID. - `external_id: str` User-provided unique ID. - `status: str` Batch status. - `generated_at: str` When the plan was generated. - `invoice_id: str` Invoice identifier. - `version: float` Plan version. - `status: str` Status of the payment flow. - `type: str` Type of payment flow. # Payments ## Retrieve `experimental.payments.retrieve(strpayment_ref) -> PaymentRetrieveResponse` **get** `/payments/{payment_ref}` Gets a payment by ID or external ID. ### Parameters - `payment_ref: str` Payment ID or external ID. ### Returns - `class PaymentRetrieveResponse: …` - `data: Payment` Payment object. - `id: str` FRAGMENT generated unique ID. - `amount: str` Amount in smallest currency unit. - `created: str` Timestamp when the payment was created. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `modified: str` Timestamp when the payment was last modified. - `payment_account_id: str` Payment account ID. - `payment_flow_id: str` Payment flow ID. - `status: str` Status of the payment. - `transaction_ids: List[str]` Associated transaction IDs. - `external_id: Optional[str]` User-provided unique ID when the payment was created with one. ### Example ```python from fragment import Fragment client = Fragment() payment = client.experimental.payments.retrieve( "pmt_abc123", ) print(payment.data) ``` ## Search `experimental.payments.search(PaymentSearchParams**kwargs) -> PaymentSearchResponse` **post** `/payments/search` Searches payments. ### Parameters - `page_info: Optional[PageInfo]` Pagination parameters. - `after: Optional[str]` Pagination cursor. - `limit: Optional[float]` Maximum number of results. - `payment_flow_id: Optional[str]` Filter by payment flow ID. ### Returns - `class PaymentSearchResponse: …` List of payments. - `data: List[Payment]` - `id: str` FRAGMENT generated unique ID. - `amount: str` Amount in smallest currency unit. - `created: str` Timestamp when the payment was created. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `modified: str` Timestamp when the payment was last modified. - `payment_account_id: str` Payment account ID. - `payment_flow_id: str` Payment flow ID. - `status: str` Status of the payment. - `transaction_ids: List[str]` Associated transaction IDs. - `external_id: Optional[str]` User-provided unique ID when the payment was created with one. ### Example ```python from fragment import Fragment client = Fragment() response = client.experimental.payments.search() print(response.data) ``` ## Domain Types ### Payment - `class Payment: …` Payment object. - `id: str` FRAGMENT generated unique ID. - `amount: str` Amount in smallest currency unit. - `created: str` Timestamp when the payment was created. - `currency: str` Currency code. - `direction: str` Direction of the payment. - `modified: str` Timestamp when the payment was last modified. - `payment_account_id: str` Payment account ID. - `payment_flow_id: str` Payment flow ID. - `status: str` Status of the payment. - `transaction_ids: List[str]` Associated transaction IDs. - `external_id: Optional[str]` User-provided unique ID when the payment was created with one.