--- displayed_sidebar: jsClientSidebar slug: /references/js-client/AdminPaymentCollectionsResource --- import ParameterTypes from "@site/src/components/ParameterTypes" # AdminPaymentCollectionsResource This class is used to send requests to [Admin Payment Collection API Routes](https://docs.medusajs.com/api/admin#payment-collections). All its method are available in the JS Client under the `medusa.admin.paymentCollections` property. All methods in this class require [user authentication](AdminAuthResource.mdx#createsession). A payment collection is useful for managing additional payments, such as for Order Edits, or installment payments. ## Methods ### delete Delete a payment collection. Only payment collections with the statuses `canceled` or `not_paid` can be deleted. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections .delete(paymentCollectionId) .then(({ id, object, deleted }) => { console.log(id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns ___ ### markAsAuthorized Set the status of a payment collection as `authorized`. This will also change the `authorized_amount` of the payment collection. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections .markAsAuthorized(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "payment_sessions", "type": "[PaymentSession](../internal/classes/internal.PaymentSession.mdx)[]", "description": "The details of the payment sessions created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "payments", "type": "[Payment](../internal/classes/internal.Payment.mdx)[]", "description": "The details of the payments created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region", "type": "[Region](../internal/classes/internal.Region.mdx)", "description": "The details of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region_id", "type": "`string`", "description": "The ID of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "status", "type": "[PaymentCollectionStatus](../internal/enums/internal.PaymentCollectionStatus.mdx)", "description": "The type of the payment collection", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "type", "type": "[ORDER_EDIT](../modules/internal.mdx#order_edit)", "description": "The type of the payment collection", "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": [] } ] } ] } ] } ]} /> ___ ### retrieve Retrieve a Payment Collection's details. #### Example A simple example that retrieves a payment collection by its ID: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections .retrieve(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) }) ``` To specify relations that should be retrieved: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections .retrieve(paymentCollectionId, { expand: "currency", }) .then(({ payment_collection }) => { console.log(payment_collection.id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "payment_sessions", "type": "[PaymentSession](../internal/classes/internal.PaymentSession.mdx)[]", "description": "The details of the payment sessions created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "payments", "type": "[Payment](../internal/classes/internal.Payment.mdx)[]", "description": "The details of the payments created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region", "type": "[Region](../internal/classes/internal.Region.mdx)", "description": "The details of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region_id", "type": "`string`", "description": "The ID of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "status", "type": "[PaymentCollectionStatus](../internal/enums/internal.PaymentCollectionStatus.mdx)", "description": "The type of the payment collection", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "type", "type": "[ORDER_EDIT](../modules/internal.mdx#order_edit)", "description": "The type of the payment collection", "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": [] } ] } ] } ] } ]} /> ___ ### update Update a payment collection's details. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections .update(paymentCollectionId, { description, }) .then(({ payment_collection }) => { console.log(payment_collection.id) }) ``` #### Parameters `", "description": "A set of key-value pairs to hold additional information.", "optional": true, "defaultValue": "", "expandable": false, "children": [] } ] }, { "name": "customHeaders", "type": "`Record`", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "payment_sessions", "type": "[PaymentSession](../internal/classes/internal.PaymentSession.mdx)[]", "description": "The details of the payment sessions created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "payments", "type": "[Payment](../internal/classes/internal.Payment.mdx)[]", "description": "The details of the payments created as part of the payment collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region", "type": "[Region](../internal/classes/internal.Region.mdx)", "description": "The details of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "region_id", "type": "`string`", "description": "The ID of the region this payment collection is associated with.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "status", "type": "[PaymentCollectionStatus](../internal/enums/internal.PaymentCollectionStatus.mdx)", "description": "The type of the payment collection", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "type", "type": "[ORDER_EDIT](../modules/internal.mdx#order_edit)", "description": "The type of the payment collection", "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": [] } ] } ] } ] } ]} />