# Experimental # Payment Flows ## Create `client.experimental.paymentFlows.create(PaymentFlowCreateParamsbody, RequestOptionsoptions?): PaymentFlowCreateResponse` **post** `/payment-flows` Creates a new payment flow. ### Parameters - `body: PaymentFlowCreateParams` - `external_id: string` User-provided unique external ID. - `invoice: ID | ExternalID` Invoice to settle. - `ID` - `id: string` Fragment invoice ID. - `ExternalID` - `external_id: string` Invoice external ID. - `type: "single_invoice_settlement"` Type of payment flow. - `"single_invoice_settlement"` ### Returns - `PaymentFlowCreateResponse` - `data: PaymentFlow` Payment flow object. - `id: string` FRAGMENT generated unique ID. - `created: string` Timestamp when the payment flow was created. - `external_id: string` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: string` Invoice identifier. - `external_id?: string` Invoice external ID. - `modified: string` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: Array` Payment batches. - `batch_id: string` Batch identifier. - `depends_on: Array` Batches this one depends on. - `label: string` Human-readable batch label. - `payments: Array` Payments in this batch. - `amount: string` Amount in smallest currency unit. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `payment_id: string` FRAGMENT generated unique ID. - `status: string` Status of the payment. - `user: User` User associated with the payment. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `status: string` Batch status. - `generated_at: string` When the plan was generated. - `invoice_id: string` Invoice identifier. - `version: number` Plan version. - `status: string` Status of the payment flow. - `type: string` Type of payment flow. ### Example ```typescript import Fragment from '@fragment-dev/ts-node'; const client = new Fragment(); const paymentFlow = await client.experimental.paymentFlows.create({ external_id: 'pf_123', invoice: { id: 'inv_abc123' }, type: 'single_invoice_settlement', }); console.log(paymentFlow.data); ``` ## Retrieve `client.experimental.paymentFlows.retrieve(stringpaymentFlowRef, RequestOptionsoptions?): PaymentFlowRetrieveResponse` **get** `/payment-flows/{payment_flow_ref}` Gets a payment flow by ID or external ID. ### Parameters - `paymentFlowRef: string` Payment flow ID or external ID. ### Returns - `PaymentFlowRetrieveResponse` - `data: PaymentFlow` Payment flow object. - `id: string` FRAGMENT generated unique ID. - `created: string` Timestamp when the payment flow was created. - `external_id: string` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: string` Invoice identifier. - `external_id?: string` Invoice external ID. - `modified: string` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: Array` Payment batches. - `batch_id: string` Batch identifier. - `depends_on: Array` Batches this one depends on. - `label: string` Human-readable batch label. - `payments: Array` Payments in this batch. - `amount: string` Amount in smallest currency unit. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `payment_id: string` FRAGMENT generated unique ID. - `status: string` Status of the payment. - `user: User` User associated with the payment. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `status: string` Batch status. - `generated_at: string` When the plan was generated. - `invoice_id: string` Invoice identifier. - `version: number` Plan version. - `status: string` Status of the payment flow. - `type: string` Type of payment flow. ### Example ```typescript import Fragment from '@fragment-dev/ts-node'; const client = new Fragment(); const paymentFlow = await client.experimental.paymentFlows.retrieve('pf_abc123'); console.log(paymentFlow.data); ``` ## Search `client.experimental.paymentFlows.search(PaymentFlowSearchParamsbody?, RequestOptionsoptions?): PaymentFlowSearchResponse` **post** `/payment-flows/search` Searches payment flows. ### Parameters - `body: PaymentFlowSearchParams` - `invoice_id?: string` Filter by invoice ID. - `page_info?: PageInfo` Pagination parameters. - `after?: string` Pagination cursor. - `limit?: number` Maximum number of results. ### Returns - `PaymentFlowSearchResponse` List of payment flows. - `data: Array` - `id: string` FRAGMENT generated unique ID. - `created: string` Timestamp when the payment flow was created. - `external_id: string` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: string` Invoice identifier. - `external_id?: string` Invoice external ID. - `modified: string` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: Array` Payment batches. - `batch_id: string` Batch identifier. - `depends_on: Array` Batches this one depends on. - `label: string` Human-readable batch label. - `payments: Array` Payments in this batch. - `amount: string` Amount in smallest currency unit. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `payment_id: string` FRAGMENT generated unique ID. - `status: string` Status of the payment. - `user: User` User associated with the payment. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `status: string` Batch status. - `generated_at: string` When the plan was generated. - `invoice_id: string` Invoice identifier. - `version: number` Plan version. - `status: string` Status of the payment flow. - `type: string` Type of payment flow. ### Example ```typescript import Fragment from '@fragment-dev/ts-node'; const client = new Fragment(); const response = await client.experimental.paymentFlows.search(); console.log(response.data); ``` ## Domain Types ### Payment Flow - `PaymentFlow` Payment flow object. - `id: string` FRAGMENT generated unique ID. - `created: string` Timestamp when the payment flow was created. - `external_id: string` User-provided unique external ID. - `invoice: Invoice` Invoice being settled. - `id: string` Invoice identifier. - `external_id?: string` Invoice external ID. - `modified: string` Timestamp when the payment flow was last modified. - `payment_plan: PaymentPlan` Payment plan for UI rendering. - `batches: Array` Payment batches. - `batch_id: string` Batch identifier. - `depends_on: Array` Batches this one depends on. - `label: string` Human-readable batch label. - `payments: Array` Payments in this batch. - `amount: string` Amount in smallest currency unit. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `payment_id: string` FRAGMENT generated unique ID. - `status: string` Status of the payment. - `user: User` User associated with the payment. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `status: string` Batch status. - `generated_at: string` When the plan was generated. - `invoice_id: string` Invoice identifier. - `version: number` Plan version. - `status: string` Status of the payment flow. - `type: string` Type of payment flow. # Payments ## Retrieve `client.experimental.payments.retrieve(stringpaymentRef, RequestOptionsoptions?): PaymentRetrieveResponse` **get** `/payments/{payment_ref}` Gets a payment by ID or external ID. ### Parameters - `paymentRef: string` Payment ID or external ID. ### Returns - `PaymentRetrieveResponse` - `data: Payment` Payment object. - `id: string` FRAGMENT generated unique ID. - `amount: string` Amount in smallest currency unit. - `created: string` Timestamp when the payment was created. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `modified: string` Timestamp when the payment was last modified. - `payment_account_id: string` Payment account ID. - `payment_flow_id: string` Payment flow ID. - `status: string` Status of the payment. - `transaction_ids: Array` Associated transaction IDs. - `external_id?: string` User-provided unique ID when the payment was created with one. ### Example ```typescript import Fragment from '@fragment-dev/ts-node'; const client = new Fragment(); const payment = await client.experimental.payments.retrieve('pmt_abc123'); console.log(payment.data); ``` ## Search `client.experimental.payments.search(PaymentSearchParamsbody?, RequestOptionsoptions?): PaymentSearchResponse` **post** `/payments/search` Searches payments. ### Parameters - `body: PaymentSearchParams` - `page_info?: PageInfo` Pagination parameters. - `after?: string` Pagination cursor. - `limit?: number` Maximum number of results. - `payment_flow_id?: string` Filter by payment flow ID. ### Returns - `PaymentSearchResponse` List of payments. - `data: Array` - `id: string` FRAGMENT generated unique ID. - `amount: string` Amount in smallest currency unit. - `created: string` Timestamp when the payment was created. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `modified: string` Timestamp when the payment was last modified. - `payment_account_id: string` Payment account ID. - `payment_flow_id: string` Payment flow ID. - `status: string` Status of the payment. - `transaction_ids: Array` Associated transaction IDs. - `external_id?: string` User-provided unique ID when the payment was created with one. ### Example ```typescript import Fragment from '@fragment-dev/ts-node'; const client = new Fragment(); const response = await client.experimental.payments.search(); console.log(response.data); ``` ## Domain Types ### Payment - `Payment` Payment object. - `id: string` FRAGMENT generated unique ID. - `amount: string` Amount in smallest currency unit. - `created: string` Timestamp when the payment was created. - `currency: string` Currency code. - `direction: string` Direction of the payment. - `modified: string` Timestamp when the payment was last modified. - `payment_account_id: string` Payment account ID. - `payment_flow_id: string` Payment flow ID. - `status: string` Status of the payment. - `transaction_ids: Array` Associated transaction IDs. - `external_id?: string` User-provided unique ID when the payment was created with one.