--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # Payment A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources. ## Constructors ### constructor `**new Payment**()` A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources. ## Properties `", "description": "The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "id", "type": "`string`", "description": "The payment's ID", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "idempotency_key", "type": "`string`", "description": "Randomly generated key used to continue the completion of a payment in case of failure.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "metadata", "type": "`Record`", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "order", "type": "[Order](Order.mdx)", "description": "The details of the order that the payment session was potentially created for.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "order_id", "type": "`string`", "description": "The ID of the order that the payment session was potentially created for.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "provider_id", "type": "`string`", "description": "The id of the Payment Provider that is responsible for the Payment", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "swap", "type": "[Swap](Swap.mdx)", "description": "The details of the swap that this payment was potentially created for.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "swap_id", "type": "`string`", "description": "The ID of the swap that this payment was potentially created for.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ## Methods ### beforeInsert `Private **beforeInsert**(): void` #### Returns `void`