import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.payment.list()
.then(({ payments, count, limit, offset }) => {
console.log(payments)
}){
"limit": 123,
"offset": 123,
"count": 123,
"payments": [
{
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {}
},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {
"id": "<string>",
"amount": 123,
"currency_code": "usd",
"provider_id": "<string>",
"data": {},
"status": "authorized",
"context": {
"customer": {
"id": "cus_123"
}
},
"authorized_at": "2023-11-07T05:31:56Z",
"payment_collection": {},
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {}
}
}
}
]
}Retrieve a list of payments. The payments can be filtered by fields such as id. The payments can also be sorted or paginated.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.payment.list()
.then(({ payments, count, limit, offset }) => {
console.log(payments)
}){
"limit": 123,
"offset": 123,
"count": 123,
"payments": [
{
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {}
},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {
"id": "<string>",
"amount": 123,
"currency_code": "usd",
"provider_id": "<string>",
"data": {},
"status": "authorized",
"context": {
"customer": {
"id": "cus_123"
}
},
"authorized_at": "2023-11-07T05:31:56Z",
"payment_collection": {},
"payment": {
"id": "<string>",
"amount": 123,
"currency_code": "<string>",
"provider_id": "<string>",
"authorized_amount": 123,
"data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"captured_amount": 123,
"refunded_amount": 123,
"captures": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"created_by": "<string>"
}
],
"refunds": [
{
"id": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"payment": {},
"refund_reason_id": "<string>",
"note": "<string>",
"created_by": "<string>",
"refund_reason": {
"id": "<string>",
"label": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"description": "<string>",
"metadata": {}
}
}
],
"payment_collection": {},
"payment_session": {}
}
}
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Search term to filter the payment's searchable properties.
Filter by a payment ID.
Filter by a payment session ID to retrieve its associated payments.
Filter by the payment's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by the payment's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by the payment's deletion date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Whether to include deleted records in the result.
OK
The paginated list of payments. The paginated list of payments.
The maximum number of returned items.
The number of items skipped before the returned items.
The total number of payments.
The list of payments.
Show child attributes
The payment's ID.
The payment's amount.
The payment's currency code.
The ID of the payment provider used to process this payment.
The amount authorized of the payment.
The payment's data, useful for processing by the payment provider.
The date the payment was created.
The date the payment was updated.
The date the payment was captured.
The date the payment was canceled.
The captured amount of the payment.
The refunded amount of the payment.
The details of payment captures.
Show child attributes
The payment capture's ID.
The captured amount.
The date the capture was created.
The ID of the user that captured the payment.
The details of payment refunds.
Show child attributes
The refund's ID.
The refund's amount.
The date the refund was created.
The payment's details.
Show child attributes
The payment's ID.
The payment's amount.
The payment's currency code.
The ID of the payment provider used to process this payment.
The amount authorized of the payment.
The payment's data, useful for processing by the payment provider.
The date the payment was created.
The date the payment was updated.
The date the payment was captured.
The date the payment was canceled.
The captured amount of the payment.
The refunded amount of the payment.
The details of payment captures.
Show child attributes
The payment capture's ID.
The captured amount.
The date the capture was created.
The ID of the user that captured the payment.
The details of payment refunds.
Show child attributes
The refund's ID.
The refund's amount.
The date the refund was created.
The ID of the refund reason.
More details about the refund.
The ID of the user that created the refund.
The refund reason's details.
Show child attributes
The refund reason's ID.
The refund reason's label.
The date the refund reason was created.
The date the refund reason was updated.
The refund reason's code.
The refund reason's description.
The refund reason's metadata, can hold custom key-value pairs.
The ID of the refund reason.
More details about the refund.
The ID of the user that created the refund.
The refund reason's details.
Show child attributes
The refund reason's ID.
The refund reason's label.
The date the refund reason was created.
The date the refund reason was updated.
The refund reason's code.
The refund reason's description.
The refund reason's metadata, can hold custom key-value pairs.
The payment session's details.
Show child attributes
The payment session's ID.
The payment session's amount.
The payment session's currency code.
"usd"
The ID of the payment provider processing this session.
The payment session's data, useful for the payment provider processing the payment.
The payment session's status.
authorized, captured, canceled, pending, requires_more, error The context around the payment, such as the customer's details.
{ "customer": { "id": "cus_123" } }The date the payment session was authorized.
The payment's details.
Show child attributes
The payment's ID.
The payment's amount.
The payment's currency code.
The ID of the payment provider used to process this payment.
The amount authorized of the payment.
The payment's data, useful for processing by the payment provider.
The date the payment was created.
The date the payment was updated.
The date the payment was captured.
The date the payment was canceled.
The captured amount of the payment.
The refunded amount of the payment.
The details of payment captures.
Show child attributes
The payment capture's ID.
The captured amount.
The date the capture was created.
The ID of the user that captured the payment.
The details of payment refunds.
Show child attributes
The refund's ID.
The refund's amount.
The date the refund was created.
The ID of the refund reason.
More details about the refund.
The ID of the user that created the refund.
The refund reason's details.
Show child attributes
The refund reason's ID.
The refund reason's label.
The date the refund reason was created.
The date the refund reason was updated.
The refund reason's code.
The refund reason's description.
The refund reason's metadata, can hold custom key-value pairs.