AdminPaymentCollectionsResource
This class is used to send requests to Admin Payment Collection API Routes. All its method
are available in the JS Client under the medusa.admin.paymentCollections
property.
All methods in this class require authentication.
A payment collection is useful for managing additional payments, such as for Order Edits, or installment payments.
Methods
retrieve
Retrieve a Payment Collection's details.
Example
A simple example that retrieves a payment collection by its ID:
To specify relations that should be retrieved:
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
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Configurations to apply on the retrieved payment collection.
Returns
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>RequiredResolves to the payment collection's details.
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>Requiredupdate
Update a payment collection's details.
Example
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
id
stringRequiredThe attributes to update in the payment collection.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>RequiredResolves to the payment collection's details.
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>Requireddelete
Delete a payment collection. Only payment collections with the statuses canceled
or not_paid
can be deleted.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminPaymentCollectionDeleteRes>RequiredResolves to the deletion operation's details.
ResponsePromise
ResponsePromise<AdminPaymentCollectionDeleteRes>RequiredmarkAsAuthorized
Set the status of a payment collection as authorized
. This will also change the authorized_amount
of the payment collection.
Example
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
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>RequiredResolves to the payment collection's details.
ResponsePromise
ResponsePromise<AdminPaymentCollectionsRes>Required