docs: add TSDoc for payment processor + generate docs (#5917)

* added tsdocs for payment processor

* generated reference for payment processor
This commit is contained in:
Shahed Nasser
2023-12-18 14:02:18 +02:00
committed by GitHub
parent e63f4e6c7a
commit ddc6cc13a0
73 changed files with 34162 additions and 17470 deletions
@@ -1,648 +0,0 @@
---
description: 'Learn how to create a payment processor in the Medusa. This guide explains the different methods available in a payment processor.'
addHowToData: true
---
# How to Create a Payment Processor
In this document, youll learn how to create a Payment Processor in your Medusa backend. If youre unfamiliar with the Payment architecture in Medusa, make sure to check out the [overview](../payment.md) first.
:::note
Before v1.8 of Medusa, this guide explained how to create a payment provider. Payment Providers are now considered legacy and are deprecated. Moving forward, it's recommended to create a Payment Processor that implements the Payment Processor API.
:::
## Overview
A Payment Processor is the payment method used to authorize, capture, and refund payment, among other actions. An example of a Payment Processor is Stripe.
By default, Medusa has a [manual payment provider](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-manual) that has minimal implementation. It can be synonymous with a Cash on Delivery payment method. It allows store operators to manage the payment themselves but still keep track of its different stages on Medusa.
Adding a Payment Processor is as simple as creating a [service](../../../development/services/create-service.mdx) file in `src/services`. A Payment Processor is essentially a service that extends `AbstractPaymentProcessor` from the core Medusa package `@medusajs/medusa`.
Payment Processor Services must have a static property `identifier`. It's the name that will be used to install and refer to the Payment Processor in the Medusa backend.
:::tip
Payment Processors are loaded and installed at the server startup. If not already saved, they're saved in the database and are represented by the `PaymentProvider` entity.
:::
The Payment Processor is also required to implement the following methods:
1. `initiatePayment`: Called when a Payment Session for the Payment Provider is to be created.
2. `retrievePayment`: Used to retrieve payment session data, which can be retrieved from a third-party provider.
3. `getPaymentStatus`: Used to get the status of a Payment or Payment Session.
4. `updatePayment`: Used to update the Payment Session whenever the cart and its related data are updated.
5. `updatePaymentData`: Used to update the `data` of a payment session.
6. `deletePayment`: Used to perform any action necessary before a Payment Session is deleted. For example, you can cancel the payment with the third-party provider.
7. `authorizePayment`: Used to authorize the payment amount of the cart before the order or swap is created.
8. `capturePayment`: Used to capture the payment amount of an order or swap.
9. `refundPayment`: Used to refund a payment amount of an order or swap.
10. `cancelPayment`: Used to perform any necessary action with the third-party payment provider when an order or swap is canceled.
:::note
All these methods must be declared async in the Payment Processor.
:::
These methods are used at different points in the Checkout flow as well as when processing the order after its placed.
![Checkout Flow - Payment](https://res.cloudinary.com/dza7lstvk/image/upload/v1680177820/Medusa%20Docs/Diagrams/checkout-payment_cy9efp.jpg)
---
## Create a Payment Processor
The first step to create a payment processor is to create a JavaScript or TypeScript file in `src/services`. The file's name should be the name of the payment processor, and it should be in snake case.
For example, create the file `src/services/my-payment-processor.ts` with the following content:
```ts title="src/services/my-payment-processor.ts"
import {
AbstractPaymentProcessor,
PaymentProcessorContext,
PaymentProcessorError,
PaymentProcessorSessionResponse,
PaymentSessionStatus,
} from "@medusajs/medusa"
class MyPaymentProcessor extends AbstractPaymentProcessor {
static identifier = "my-payment"
async capturePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
throw new Error("Method not implemented.")
}
async authorizePayment(
paymentSessionData: Record<string, unknown>,
context: Record<string, unknown>
): Promise<
PaymentProcessorError |
{
status: PaymentSessionStatus;
data: Record<string, unknown>;
}
> {
throw new Error("Method not implemented.")
}
async cancelPayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
throw new Error("Method not implemented.")
}
async initiatePayment(
context: PaymentProcessorContext
): Promise<
PaymentProcessorError | PaymentProcessorSessionResponse
> {
throw new Error("Method not implemented.")
}
async deletePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
throw new Error("Method not implemented.")
}
async getPaymentStatus(
paymentSessionData: Record<string, unknown>
): Promise<PaymentSessionStatus> {
throw new Error("Method not implemented.")
}
async refundPayment(
paymentSessionData: Record<string, unknown>,
refundAmount: number
): Promise<Record<string, unknown> | PaymentProcessorError> {
throw new Error("Method not implemented.")
}
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
throw new Error("Method not implemented.")
}
async updatePayment(
context: PaymentProcessorContext
): Promise<
void |
PaymentProcessorError |
PaymentProcessorSessionResponse
> {
throw new Error("Method not implemented.")
}
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
throw new Error("Method not implemented.")
}
}
export default MyPaymentProcessor
```
Where `MyPaymentProcessor` is the name of your Payment Processor service.
Payment Processors must extend `AbstractPaymentProcessor` from the core Medusa package `@medusajs/medusa`.
:::tip
Following the naming convention of Services, the name of the file should be the slug name of the Payment Processor, and the name of the class should be the camel case name of the Payment Processors suffixed with “Service”. In the example above, the name of the file should be `my-payment.ts`. You can learn more in the [service documentation](../../../development/services/create-service.mdx).
:::
### identifier
As mentioned in the overview, Payment Processors should have a static `identifier` property.
The `PaymentProvider` entity has 2 properties: `identifier` and `is_installed`. The value of the `identifier` property in the class will be used when the Payment Processor is created in the database.
The value of this property will also be used to reference the Payment Processor throughout the Medusa backend. For example, the identifier is used when a [Payment Session in a cart is selected on checkout](https://docs.medusajs.com/api/store#carts_postcartscartpaymentsession).
The identifier can be retrieved using the `getIdentifier` method, which is defined in `AbstractPaymentProcessor`.
### constructor
You can use the `constructor` of your Payment Processor to have access to different services in Medusa through [dependency injection](../../../development/fundamentals/dependency-injection.md).
You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party providers APIs, you can initialize it in the constructor and use it in other methods in the service.
Additionally, if youre creating your Payment Processor as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin, you can access it in the constructor. The options are passed as a second parameter:
```ts
class MyPaymentService extends AbstractPaymentProcessor {
// ...
constructor(container, options) {
super(container)
// you can access options here
}
// ...
}
```
### PaymentProcessorError
Before diving into the methods you'll need to implement, you'll notice that part of the expected return signature of these method includes `PaymentProcessorError`. This is an interface of the following definition:
```ts
interface PaymentProcessorError {
error: string
code?: string
detail?: any
}
```
While implementing the following methods, if you need to inform the Medusa core that an error occurred at a certain stage, return an object having the attributes defined in the `PaymentProcessorError` interface.
For example, the Stripe payment processor has the following method to create the error object, which is used within other methods:
```ts
abstract class StripeBase extends AbstractPaymentProcessor {
// ...
protected buildError(
message: string,
e: Stripe.StripeRawError | PaymentProcessorError | Error
): PaymentProcessorError {
return {
error: message,
code: "code" in e ? e.code : "",
detail: isPaymentProcessorError(e)
? `${e.error}${EOL}${e.detail ?? ""}`
: "detail" in e
? e.detail
: e.message ?? "",
}
}
// used in other methods
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<
PaymentProcessorError |
PaymentProcessorSessionResponse["session_data"]
> {
try {
// ...
} catch (e) {
return this.buildError(
"An error occurred in retrievePayment",
e
)
}
}
}
```
### initiatePayment
This method is called either if a region has only one payment provider enabled or when [a Payment Session is selected](https://docs.medusajs.com/api/store#carts_postcartscartpaymentsession), which occurs when the customer selects their preferred payment method during checkout. It is used to allow you to make any necessary calls to the third-party provider to initialize the payment.
For example, in Stripe this method is used to create a Payment Intent for the customer.
The method receives a context object as a first parameter. This object is of type `PaymentProcessorContext` and has the following properties:
```ts
type PaymentProcessorContext = {
billing_address?: Address | null
email: string
currency_code: string
amount: number
resource_id: string
customer?: Customer
context: Record<string, unknown>
paymentSessionData: Record<string, unknown>
}
```
This method must return an object of type `PaymentProcessorSessionResponse`. It should have the following properties:
```ts
type PaymentProcessorSessionResponse = {
update_requests?: {
customer_metadata?: Record<string, unknown>
}
session_data: Record<string, unknown>
}
```
Where:
- `session_data` is the data that is going to be stored in the `data` field of the Payment Session to be created. As mentioned in the [Architecture Overview](../payment.md), the `data` field is useful to hold any data required by the third-party provider to process the payment or retrieve its details at a later point.
- `update_requests` is an object that can be used to pass data from the Payment Processor plugin to the core to update internal resources. Currently, it only has one attribute `customer_metadata` which allows updating the `metadata` field of the customer.
An example of a minimal implementation of `initiatePayment`:
```ts
import {
PaymentContext,
PaymentSessionResponse,
} from "@medusajs/medusa"
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async initiatePayment(
context: PaymentProcessorContext
): Promise<
PaymentProcessorError | PaymentProcessorSessionResponse
> {
// prepare data
return {
session_data,
update_requests,
}
}
}
```
### retrievePayment
This method is used to provide a uniform way of retrieving the payment information from the third-party provider. For example, in Stripes Payment Processor this method is used to retrieve the payment intent details from Stripe.
This method accepts the `data` field of a Payment Session. So, you should make sure to store in the `data` field any necessary data that would allow you to retrieve the payment data from the third-party provider.
This method must return an object containing the data from the third-party provider.
An example of a minimal implementation of `retrievePayment` where you dont need to interact with the third-party provider:
```ts
import { Data } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
return {}
}
}
```
### getPaymentStatus
This method is used to get the status of a Payment or a Payment Session.
Its main usage is in the place order and create swap workflows. If the status returned is not `authorized`, then the payment is considered failed and an error will be thrown, stopping the task from completion.
This method accepts the `data` field of a Payment as a parameter. You can use this data to interact with the third-party provider to check the status of the payment if necessary.
This method returns a string that represents the status. This string can be from the enum `PaymentSessionStatus` which can be imported from `@medusajs/medusa`. The status must be one of the following values:
1. `authorized`: The payment was successfully authorized.
2. `pending`: The payment is still pending. This is the default status of a Payment Session.
3. `requires_more`: The payment requires more actions from the customer. For example, if the customer must complete a 3DS check before the payment is authorized.
4. `error`: If an error occurred with the payment.
5. `canceled`: If the payment was canceled.
An example of a minimal implementation of `getPaymentStatus` where you dont need to interact with the third-party provider:
```ts
import { Data, PaymentSessionStatus } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async getPaymentStatus(
paymentSessionData: Record<string, unknown>
): Promise<PaymentSessionStatus> {
return PaymentSessionStatus.AUTHORIZED
}
}
```
### updatePayment
This method is used to update the payment session when the payment amount changes. It's called whenever the cart or any of its related data is updated. For example, when a [line item is added to the cart](https://docs.medusajs.com/api/store#carts_postcartscartlineitems) or when a [shipping method is selected](https://docs.medusajs.com/api/store#carts_postcartscartshippingmethod).
:::tip
A line item refers to a product in the cart.
:::
It accepts the `data` field of the Payment Session as the first parameter and a context object as a second parameter. This object is of type `PaymentProcessorContext` and has the following properties:
```ts
type PaymentProcessorContext = {
billing_address?: Address | null
email: string
currency_code: string
amount: number
resource_id: string
customer?: Customer
context: Record<string, unknown>
paymentSessionData: Record<string, unknown>
}
```
You can utilize this method to interact with the third-party provider and update any details regarding the payment if necessary.
This method must return an object of type `PaymentSessionResponse`. It should have the following properties:
```ts
type PaymentProcessorSessionResponse = {
update_requests?: {
customer_metadata?: Record<string, unknown>
}
session_data: Record<string, unknown>
}
```
These are the same fields explained in the [initiatePayment](#initiatepayment) section.
An example of a minimal implementation of `updatePayment`:
```ts
import {
PaymentSessionData,
Cart,
PaymentContext,
PaymentSessionResponse,
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async updatePayment(
context: PaymentProcessorContext
): Promise<
void |
PaymentProcessorError |
PaymentProcessorSessionResponse
> {
// prepare data
return {
session_data,
update_requests,
}
}
}
```
### updatePaymentData
This method is used to update the `data` field of a payment session. It's called when a request is sent to the [Update Payment Session API Route](https://docs.medusajs.com/api/store#carts_postcartscartpaymentsessionupdate), or when the `CartService`'s `updatePaymentSession` is used.
This method can also be used to update the data in the third-party payment provider, if necessary.
The method accepts the following parameters:
1. `sessionId`: A string that indicates the ID of the payment session.
2. `data`: An object containing the data to be updated.
The method returns the data to store in the `data` field of the payment session. You can keep the data as-is, or make changes to it by communicating with the third-party provider.
An example of a minimal implementation of `updatePaymentData` that returns the `data` field as-is:
```ts
import {
PaymentProcessorError,
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
return data
}
}
```
### deletePayment
This method is used to perform any actions necessary before a Payment Session is deleted. The Payment Session is deleted in one of the following cases:
1. When a request is sent to [delete the Payment Session](https://docs.medusajs.com/api/store#carts_deletecartscartpaymentsessionssession).
2. When the [Payment Session is refreshed](https://docs.medusajs.com/api/store#carts_postcartscartpaymentsessionssession). The Payment Session is deleted so that a newer one is initialized instead.
3. When the Payment Processor is no longer available. This generally happens when the store operator removes it from the available Payment Processor in the admin.
4. When the region of the store is changed based on the cart information and the Payment Processor is not available in the new region.
It accepts the `data` field of the payment session for its first parameter.
You can use this method to interact with the third-party provider to delete data related to the Payment Session if necessary.
An example of a minimal implementation of `deletePayment` where no interaction with a third-party provider is required:
```ts
import { PaymentSession } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async deletePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
return paymentSessionData
}
}
```
### authorizePayment
This method is used to authorize payment using the Payment Session of an order. This is called when the [cart is completed](https://docs.medusajs.com/api/store#carts_postcartscartcomplete) and before the order is created.
This method is also used for authorizing payments of a swap of an order and when authorizing sessions in a payment collection.
The payment authorization might require additional action from the customer before it is declared authorized. Once that additional action is performed, the `authorizePayment` method will be called again to validate that the payment is now fully authorized. So, you should make sure to implement it for this case as well, if necessary.
Once the payment is authorized successfully and the Payment Session status is set to `authorized`, the order can then be placed.
If the payment authorization fails, then an error will be thrown and the order will not be created.
:::note
The payment authorization status is determined using the `getPaymentStatus` method as mentioned earlier. If the status is `requires_more` then it means additional actions are required from the customer. If the workflow process reaches the “Start Create Order” step and the status is not `authorized`, then the payment is considered failed.
:::
This method accepts the `data` field of a payment session for its first parameter, and a `context` object as a second parameter. The `context` object may contain the following properties:
1. `ip`: The customers IP.
2. `idempotency_key`: The [Idempotency Key](../payment.md#idempotency-key) that is associated with the current cart. It is useful when retrying payments, retrying checkout at a failed point, or for payments that require additional actions from the customer.
3. `cart_id`: The ID of a cart. This is only during operations like placing an order or creating a swap.
This method must return an object containing the following properties:
- `status` which is a string that indicates the current status of the payment.
- `data` which is an object containing any additional information required to perform additional payment processing such as capturing the payment. The values of both of these properties are stored in the Payment Sessions `status` and `data` fields respectively.
You can utilize this method to interact with the third-party provider and perform any actions necessary to authorize the payment.
An example of a minimal implementation of `authorizePayment` that doesnt need to interact with any third-party provider:
```ts
import {
Data,
PaymentSession,
PaymentSessionStatus,
PaymentSessionData,
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async authorizePayment(
paymentSessionData: Record<string, unknown>,
context: Record<string, unknown>
): Promise<
PaymentProcessorError |
{
status: PaymentSessionStatus;
data: Record<string, unknown>;
}
> {
return {
status: PaymentSessionStatus.AUTHORIZED,
data: {
id: "test",
},
}
}
}
```
### capturePayment
This method is used to capture the payment amount of an order. This is typically triggered manually by the store operator from the admin.
This method is also used for capturing payments of a swap of an order, or when a request is sent to the [Capture Payment API Route](https://docs.medusajs.com/api/admin#payments_postpaymentspaymentcapture).
You can utilize this method to interact with the third-party provider and perform any actions necessary to capture the payment.
This method accepts the `data` field of the Payment for its first parameter.
This method must return an object that will be stored in the `data` field of the Payment.
An example of a minimal implementation of `capturePayment` that doesnt need to interact with a third-party provider:
```ts
import { Data, Payment } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async capturePayment(payment: Payment): Promise<Data> {
return {
status: "captured",
}
}
}
```
### refundPayment
This method is used to refund an orders payment. This is typically triggered manually by the store operator from the admin. The refund amount might be the total order amount or part of it.
This method is also used for refunding payments of a swap or a claim of an order, or when a request is sent to the [Refund Payment API Route](https://docs.medusajs.com/api/admin#payments_postpaymentspaymentrefunds).
You can utilize this method to interact with the third-party provider and perform any actions necessary to refund the payment.
This method accepts the `data` field of a Payment for its first parameter, and the amount to refund as a second parameter.
This method must return an object that is stored in the `data` field of the Payment.
An example of a minimal implementation of `refundPayment` that doesnt need to interact with a third-party provider:
```ts
import { Data, Payment } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async refundPayment(
paymentSessionData: Record<string, unknown>,
refundAmount: number
): Promise<Record<string, unknown> | PaymentProcessorError> {
return {
id: "test",
}
}
}
```
### cancelPayment
This method is used to cancel an orders payment. This method is typically triggered by one of the following situations:
1. Before an order is placed and after the payment is authorized, an inventory check is done on products to ensure that products are still available for purchase. If the inventory check fails for any of the products, the payment is canceled.
2. If the store operator cancels the order from the admin.
3. When the payment of an order's swap is canceled.
You can utilize this method to interact with the third-party provider and perform any actions necessary to cancel the payment.
This method accepts the `data` field of the Payment for its first parameter.
An example of a minimal implementation of `cancelPayment` that doesnt need to interact with a third-party provider:
```ts
import { Data, Payment } from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async cancelPayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
return {
id: "test",
}
}
}
```
---
## See Also
- Implementation Examples: [Stripe](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-stripe) and [PayPal](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-paypal) Payment Processors.
- [Implement checkout flow on the storefront](../storefront/implement-checkout-flow.mdx).
@@ -141,4 +141,4 @@ You can learn more about idempotency keys [here](../../development/idempotency-k
## See Also
- [Available Payment Plugins](../../plugins/payment/index.mdx)
- [Create a Payment Processor](./backend/add-payment-provider.md)
- [Create a Payment Processor](../../references/payment/classes/payment.AbstractPaymentProcessor.mdx)
@@ -2,6 +2,6 @@ import DocCardList from '@theme/DocCardList';
# Payment Plugins
If you can't find your payment provider, try checking the [Community Plugins Library](https://medusajs.com/plugins/?filters=Payment&categories=Payment). You can also [create your own fulfillment provider](../../modules/carts-and-checkout/backend/add-payment-provider.md).
If you can't find your payment provider, try checking the [Community Plugins Library](https://medusajs.com/plugins/?filters=Payment&categories=Payment). You can also [create your own fulfillment provider](../../references/payment/classes/payment.AbstractPaymentProcessor.mdx).
<DocCardList />
@@ -179,32 +179,5 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
"children": []
}
]
},
{
"name": "server.keepAlive",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "server.type",
"type": "`\"http\"`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "server.url",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -24,13 +24,15 @@ import { AbstractFulfillmentService } from "@medusajs/medusa"
class MyFulfillmentService extends AbstractFulfillmentService {
// methods here...
}
export default MyFulfillmentService
```
---
## Identifier Property
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the class is used when the fulfillment provider is created in the database.
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the fulfillment provider service is used when the fulfillment provider is added to the database.
The value of this property is also used to reference the fulfillment provider throughout Medusa. For example, it is used to [add a fulfillment provider](https://docs.medusajs.com/api/admin#regions\_postregionsregionfulfillmentproviders) to a region.
@@ -54,8 +56,15 @@ Additionally, if youre creating your fulfillment provider as an external plug
```ts
class MyFulfillmentService extends AbstractFulfillmentService {
static identifier = "my-fulfillment"
// ...
constructor(container, options) {
super(container)
// you can access options here
// you can also initialize a client that
// communicates with a third-party service.
this.client = new Client(options)
}
// ...
}
```
@@ -21,13 +21,15 @@ import { AbstractFulfillmentService } from "@medusajs/medusa"
class MyFulfillmentService extends AbstractFulfillmentService {
// methods here...
}
export default MyFulfillmentService
```
---
## Identifier Property
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the class is used when the fulfillment provider is created in the database.
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the fulfillment provider service is used when the fulfillment provider is added to the database.
The value of this property is also used to reference the fulfillment provider throughout Medusa. For example, it is used to [add a fulfillment provider](https://docs.medusajs.com/api/admin#regions\_postregionsregionfulfillmentproviders) to a region.
@@ -193,7 +193,7 @@ medusa.admin.notifications.list({
{
"name": "count",
"type": "`number`",
"description": "",
"description": "The total number of notifications",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -202,7 +202,7 @@ medusa.admin.notifications.list({
{
"name": "limit",
"type": "`number`",
"description": "",
"description": "The number of notifications per page",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -211,7 +211,7 @@ medusa.admin.notifications.list({
{
"name": "offset",
"type": "`number`",
"description": "",
"description": "The number of notifications skipped when retrieving the notifications.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -3329,12 +3329,30 @@ medusa.admin.regions.list({
}
]
},
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "Limit the number of items returned in the list.",
"optional": true,
"defaultValue": "50",
"defaultValue": "20",
"expandable": false,
"children": []
},
@@ -73,7 +73,7 @@ medusa.admin.shippingOptions.create({
},
{
"name": "data",
"type": "`object`",
"type": "`Record<string, unknown>`",
"description": "The data needed for the Fulfillment Provider to handle shipping with this Shipping Option.",
"optional": false,
"defaultValue": "",
@@ -119,12 +119,31 @@ medusa.admin.shippingOptions.create({
},
{
"name": "price_type",
"type": "`string`",
"type": "[ShippingOptionPriceType](../../entities/enums/entities.ShippingOptionPriceType.mdx)",
"description": "The type of the Shipping Option price. `flat\\_rate` indicates fixed pricing, whereas `calculated` indicates that the price will be calculated each time by the fulfillment provider.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "CALCULATED",
"type": "`\"calculated\"`",
"description": "The shipping option's price is calculated. In this case, the `amount` field is typically `null`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "FLAT_RATE",
"type": "`\"flat_rate\"`",
"description": "The shipping option's price is a flat rate.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "profile_id",
@@ -172,12 +191,31 @@ medusa.admin.shippingOptions.create({
},
{
"name": "type",
"type": "`string`",
"type": "[RequirementType](../../entities/enums/entities.RequirementType.mdx)",
"description": "The type of the requirement",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "MAX_SUBTOTAL",
"type": "`\"max_subtotal\"`",
"description": "The shipping option can only be applied if the subtotal is less than the requirement's amont.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "MIN_SUBTOTAL",
"type": "`\"min_subtotal\"`",
"description": "The shipping option can only be applied if the subtotal is greater than the requirement's amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
@@ -1804,6 +1842,34 @@ medusa.admin.shippingOptions.update(optionId, {
"expandable": false,
"children": []
},
{
"name": "price_type",
"type": "[ShippingOptionPriceType](../../entities/enums/entities.ShippingOptionPriceType.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "CALCULATED",
"type": "`\"calculated\"`",
"description": "The shipping option's price is calculated. In this case, the `amount` field is typically `null`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "FLAT_RATE",
"type": "`\"flat_rate\"`",
"description": "The shipping option's price is a flat rate.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "requirements",
"type": "[OptionRequirement](../../medusa/classes/medusa.OptionRequirement-1.mdx)[]",
@@ -262,7 +262,7 @@ medusa.admin.stockLocations.delete(stockLocationId)
"type": "`boolean`",
"description": "Whether the item was deleted successfully.",
"optional": false,
"defaultValue": "",
"defaultValue": "true",
"expandable": false,
"children": []
},
@@ -280,7 +280,7 @@ medusa.admin.stockLocations.delete(stockLocationId)
"type": "`string`",
"description": "The type of the item that was deleted.",
"optional": false,
"defaultValue": "",
"defaultValue": "stock_location",
"expandable": false,
"children": []
}
@@ -457,7 +457,7 @@ medusa.admin.stockLocations.list({
{
"name": "count",
"type": "`number`",
"description": "",
"description": "The total number of notifications",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -466,7 +466,7 @@ medusa.admin.stockLocations.list({
{
"name": "limit",
"type": "`number`",
"description": "",
"description": "The number of notifications per page",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -475,7 +475,7 @@ medusa.admin.stockLocations.list({
{
"name": "offset",
"type": "`number`",
"description": "",
"description": "The number of notifications skipped when retrieving the notifications.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -68,7 +68,7 @@ medusa.regions.list()
{
"name": "count",
"type": "`number`",
"description": "",
"description": "The total number of notifications",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -77,7 +77,7 @@ medusa.regions.list()
{
"name": "limit",
"type": "`number`",
"description": "",
"description": "The number of notifications per page",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -86,7 +86,7 @@ medusa.regions.list()
{
"name": "offset",
"type": "`number`",
"description": "",
"description": "The number of notifications skipped when retrieving the notifications.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -21,13 +21,15 @@ import { AbstractFulfillmentService } from "@medusajs/medusa"
class MyFulfillmentService extends AbstractFulfillmentService {
// methods here...
}
export default MyFulfillmentService
```
---
## Identifier Property
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the class is used when the fulfillment provider is created in the database.
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the fulfillment provider service is used when the fulfillment provider is added to the database.
The value of this property is also used to reference the fulfillment provider throughout Medusa. For example, it is used to [add a fulfillment provider](https://docs.medusajs.com/api/admin#regions\_postregionsregionfulfillmentproviders) to a region.
@@ -51,8 +53,15 @@ Additionally, if youre creating your fulfillment provider as an external plug
```ts
class MyFulfillmentService extends AbstractFulfillmentService {
static identifier = "my-fulfillment"
// ...
constructor(container, options) {
super(container)
// you can access options here
// you can also initialize a client that
// communicates with a third-party service.
this.client = new Client(options)
}
// ...
}
```
@@ -6,17 +6,139 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
# AbstractPaymentProcessor
Payment processor in charge of creating , managing and processing a payment
## Overview
A Payment Processor is the payment method used to authorize, capture, and refund payment, among other actions. An example of a Payment Processor is Stripe.
By default, Medusa has a `manual` payment provider that has minimal implementation. It can be synonymous with a Cash on Delivery payment method. It allows
store operators to manage the payment themselves but still keep track of its different stages on Medusa.
A payment processor is a service that extends the `AbstractPaymentProcessor` and implements its methods. So, adding a Payment Processor is as simple as
creating a service file in `src/services`. The file's name is the payment processor's class name as a slug and without the word `Service`.
For example, if you're creating a `MyPaymentService` class, the file name is `src/services/my-payment.ts`.
```ts
import { AbstractPaymentProcessor } from "@medusajs/medusa";
class MyPaymentService extends AbstractPaymentProcessor {
// methods here...
}
export default MyPaymentService
```
The methods of the payment processor are used at different points in the Checkout flow as well as when processing an order after its placed.
![Checkout Flow - Payment](https://res.cloudinary.com/dza7lstvk/image/upload/v1680177820/Medusa%20Docs/Diagrams/checkout-payment\_cy9efp.jpg)
---
## Identifier Property
The `PaymentProvider` entity has 2 properties: `id` and `is_installed`. The `identifier` property in the payment processor service is used when the payment processor is added to the database.
The value of this property is also used to reference the payment processor throughout Medusa.
For example, it is used to [add a payment processor](https://docs.medusajs.com/api/admin#regions\_postregionsregionpaymentproviders) to a region.
```ts
class MyPaymentService extends AbstractPaymentProcessor {
static identifier = "my-payment"
// ...
}
```
---
## PaymentProcessorError
Before diving into the methods of the Payment Processor, you'll notice that part of the expected return signature of these method includes `PaymentProcessorError`.
```ts
interface PaymentProcessorError {
error: string
code?: string
detail?: any
}
```
While implementing the Payment Processor's methods, if you need to inform the Medusa core that an error occurred at a certain stage,
return an object having the attributes defined in the `PaymentProcessorError` interface.
For example, the Stripe payment processor has the following method to create the error object, which is used within other methods:
```ts
abstract class StripeBase extends AbstractPaymentProcessor {
// ...
protected buildError(
message: string,
e: Stripe.StripeRawError | PaymentProcessorError | Error
): PaymentProcessorError {
return {
error: message,
code: "code" in e ? e.code : "",
detail: isPaymentProcessorError(e)
? `${e.error}${EOL}${e.detail ?? ""}`
: "detail" in e
? e.detail
: e.message ?? "",
}
}
// used in other methods
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<
PaymentProcessorError |
PaymentProcessorSessionResponse["session_data"]
> {
try {
// ...
} catch (e) {
return this.buildError(
"An error occurred in retrievePayment",
e
)
}
}
}
```
---
## constructor
You can use the `constructor` of your Payment Processor to have access to different services in Medusa through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection).
You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party providers APIs,
you can initialize it in the constructor and use it in other methods in the service.
Additionally, if youre creating your Payment Processor as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin,
you can access it in the constructor. The options are passed as a second parameter.
### Example
```ts
class MyPaymentService extends AbstractPaymentProcessor {
// ...
constructor(container, options) {
super(container)
// you can access options here
// you can also initialize a client that
// communicates with a third-party service.
this.client = new Client(options)
}
// ...
}
```
### Parameters
<ParameterTypes parameters={[
{
"name": "container",
"type": "[MedusaContainer](../types/medusa.MedusaContainer-2.mdx)",
"description": "",
"description": "An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -44,7 +166,7 @@ Payment processor in charge of creating , managing and processing a payment
{
"name": "config",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -60,7 +182,7 @@ ___
{
"name": "config",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -69,7 +191,7 @@ ___
{
"name": "container",
"type": "[MedusaContainer](../types/medusa.MedusaContainer-2.mdx)",
"description": "",
"description": "An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -97,7 +219,7 @@ ___
{
"name": "identifier",
"type": "`string`",
"description": "",
"description": "The `PaymentProvider` entity has 2 properties: `id` and `is_installed`. The `identifier` property in the payment processor service is used when the payment processor is added to the database.\n\nThe value of this property is also used to reference the payment processor throughout Medusa.\nFor example, it is used to [add a payment processor](https://docs.medusajs.com/api/admin#regions\\_postregionsregionpaymentproviders) to a region.\n\n```ts\nclass MyPaymentService extends AbstractPaymentProcessor {\n static identifier = \"my-payment\"\n // ...\n}\n```",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -111,7 +233,64 @@ ___
### authorizePayment
Authorize an existing session if it is not already authorized
This method is used to authorize payment using the Payment Session of an order. This is called when the
[cart is completed](https://docs.medusajs.com/api/store#carts\_postcartscartcomplete) and before the order is created.
This method is also used for authorizing payments of a swap of an order and when authorizing sessions in a payment collection.
You can interact with a third-party provider and perform any actions necessary to authorize the payment.
The payment authorization might require additional action from the customer before it is declared authorized. Once that additional action is performed,
the `authorizePayment` method will be called again to validate that the payment is now fully authorized. So, make sure to implement it for this case as well, if necessary.
Once the payment is authorized successfully and the Payment Session status is set to `authorized`, the associated order or swap can then be placed or created.
If the payment authorization fails, then an error will be thrown and the order will not be created.
:::note
The payment authorization status is determined using the [getPaymentStatus](medusa.AbstractPaymentProcessor.mdx#getpaymentstatus) method. If the status is `requires_more`, then it means additional actions are required
from the customer. If you try to create the order with a status that isn't `authorized`, the process will fail.
:::
#### Example
```ts
import {
PaymentProcessorError,
PaymentSessionStatus,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async authorizePayment(
paymentSessionData: Record<string, unknown>,
context: Record<string, unknown>
): Promise<
PaymentProcessorError |
{
status: PaymentSessionStatus;
data: Record<string, unknown>;
}
> {
try {
await this.client.authorize(paymentSessionData.id)
return {
status: PaymentSessionStatus.AUTHORIZED,
data: {
id: paymentSessionData.id
}
}
} catch (e) {
return {
error: e.message
}
}
}
}
```
#### Parameters
@@ -119,7 +298,7 @@ Authorize an existing session if it is not already authorized
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -128,7 +307,7 @@ Authorize an existing session if it is not already authorized
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The context of the authorization. It may include some of the following fields:\n\n- `ip`: The customers IP.\n- `idempotency_key`: The [Idempotency Key](https://docs.medusajs.com/modules/carts-and-checkout/payment#idempotency-key) that is associated with the current cart. It is useful when retrying payments, retrying checkout at a failed point, or for payments that require additional actions from the customer.\n- `cart_id`: The ID of a cart. This is only during operations like placing an order or creating a swap.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -144,7 +323,7 @@ Authorize an existing session if it is not already authorized
"type": "Promise&#60;[PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| object&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The authorization details or an error object.",
"expandable": false,
"children": [
{
@@ -164,7 +343,41 @@ ___
### cancelPayment
Cancel an existing session
This method is used to cancel an orders payment. This method is typically triggered by one of the following situations:
1. Before an order is placed and after the payment is authorized, an inventory check is done on products to ensure that products are still available for purchase. If the inventory check fails for any of the products, the payment is canceled.
2. If the store operator cancels the order from the admin.
3. When the payment of an order's swap is canceled.
You can utilize this method to interact with the third-party provider and perform any actions necessary to cancel the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async cancelPayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const cancelData = this.client.cancel(paymentId)
return {
id: paymentId,
...cancelData
}
}
}
```
#### Parameters
@@ -172,7 +385,7 @@ Cancel an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -188,7 +401,7 @@ Cancel an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -208,7 +421,39 @@ ___
### capturePayment
Capture an existing session
This method is used to capture the payment amount of an order. This is typically triggered manually by the store operator from the admin.
This method is also used for capturing payments of a swap of an order, or when a request is sent to the [Capture Payment API Route](https://docs.medusajs.com/api/admin#payments\_postpaymentspaymentcapture).
You can utilize this method to interact with the third-party provider and perform any actions necessary to capture the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async capturePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const captureData = this.client.catch(paymentId)
return {
id: paymentId,
...captureData
}
}
}
```
#### Parameters
@@ -216,7 +461,7 @@ Capture an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment for its first parameter.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -232,7 +477,7 @@ Capture an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -252,7 +497,36 @@ ___
### deletePayment
Delete an existing session
This method is used to perform any actions necessary before a Payment Session is deleted. The Payment Session is deleted in one of the following cases:
1. When a request is sent to [delete the Payment Session](https://docs.medusajs.com/api/store#carts\_deletecartscartpaymentsessionssession).
2. When the [Payment Session is refreshed](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsessionssession). The Payment Session is deleted so that a newer one is initialized instead.
3. When the Payment Processor is no longer available. This generally happens when the store operator removes it from the available Payment Processor in the admin.
4. When the region of the store is changed based on the cart information and the Payment Processor is not available in the new region.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async deletePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
this.client.delete(paymentId)
return {}
}
}
```
#### Parameters
@@ -260,7 +534,7 @@ Delete an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment Session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -276,7 +550,7 @@ Delete an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or an empty object.",
"expandable": false,
"children": [
{
@@ -294,29 +568,33 @@ Delete an existing session
___
### getIdentifier
Return a unique identifier to retrieve the payment plugin provider
#### Returns
<ParameterTypes parameters={[
{
"name": "string",
"type": "`string`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### getPaymentStatus
Return the status of the session
This method is used to get the status of a Payment or a Payment Session. Its main usage is within the place order and create swap flows.
If the status returned is not `authorized` within these flows, then the payment is considered failed and an error will be thrown, stopping the flow from completion.
#### Example
```ts
import {
PaymentSessionStatus
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async getPaymentStatus(
paymentSessionData: Record<string, unknown>
): Promise<PaymentSessionStatus> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
return await this.client.getStatus(paymentId) as PaymentSessionStatus
}
}
```
#### Parameters
@@ -324,7 +602,7 @@ Return the status of the session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment as a parameter. You can use this data to interact with the third-party provider to check the status of the payment if necessary.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -340,7 +618,7 @@ Return the status of the session
"type": "Promise&#60;[PaymentSessionStatus](../../entities/enums/entities.PaymentSessionStatus.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The status of the Payment or Payment Session.",
"expandable": false,
"children": [
{
@@ -360,15 +638,47 @@ ___
### initiatePayment
Initiate a payment session with the external provider
This method is called either if a region has only one payment provider enabled or when [a Payment Session is selected](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsession),
which occurs when the customer selects their preferred payment method during checkout.
It is used to allow you to make any necessary calls to the third-party provider to initialize the payment. For example, in Stripe this method is used to create a Payment Intent for the customer.
#### Example
```ts
import {
PaymentContext,
PaymentSessionResponse,
// ...
} from "@medusajs/medusa"
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async initiatePayment(
context: PaymentProcessorContext
): Promise<
PaymentProcessorError | PaymentProcessorSessionResponse
> {
// assuming client is an initialized client
// communicating with a third-party service.
const clientPayment = await this.client.initiate(context)
return {
session_data: {
id: clientPayment.id
},
}
}
}
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "context",
"type": "[PaymentProcessorContext](../types/medusa.PaymentProcessorContext.mdx)",
"description": "",
"type": "[PaymentProcessorContext](../interfaces/medusa.PaymentProcessorContext.mdx)",
"description": "The context of the payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -376,7 +686,7 @@ Initiate a payment session with the external provider
{
"name": "amount",
"type": "`number`",
"description": "",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -384,8 +694,8 @@ Initiate a payment session with the external provider
},
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -394,7 +704,7 @@ Initiate a payment session with the external provider
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -403,7 +713,7 @@ Initiate a payment session with the external provider
{
"name": "currency_code",
"type": "`string`",
"description": "",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -412,7 +722,7 @@ Initiate a payment session with the external provider
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "A customer can make purchases in your store and manage their profile.",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -421,7 +731,7 @@ Initiate a payment session with the external provider
{
"name": "email",
"type": "`string`",
"description": "",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -430,7 +740,7 @@ Initiate a payment session with the external provider
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -439,7 +749,7 @@ Initiate a payment session with the external provider
{
"name": "resource_id",
"type": "`string`",
"description": "",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -454,15 +764,15 @@ Initiate a payment session with the external provider
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"type": "Promise&#60;[PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either the payment's data or an error object.",
"expandable": false,
"children": [
{
"name": "PaymentProcessorError \\| PaymentProcessorSessionResponse",
"type": "[PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)",
"type": "[PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/medusa.PaymentProcessorSessionResponse.mdx)",
"optional": true,
"defaultValue": "",
"description": "",
@@ -477,7 +787,40 @@ ___
### refundPayment
Refund an existing session
This method is used to refund an orders payment. This is typically triggered manually by the store operator from the admin. The refund amount might be the total order amount or part of it.
This method is also used for refunding payments of a swap or a claim of an order, or when a request is sent to the [Refund Payment API Route](https://docs.medusajs.com/api/admin#payments\_postpaymentspaymentrefunds).
You can utilize this method to interact with the third-party provider and perform any actions necessary to refund the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async refundPayment(
paymentSessionData: Record<string, unknown>,
refundAmount: number
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const refundData = this.client.refund(paymentId, refundAmount)
return {
id: paymentId,
...refundData
}
}
}
```
#### Parameters
@@ -485,7 +828,7 @@ Refund an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -494,7 +837,7 @@ Refund an existing session
{
"name": "refundAmount",
"type": "`number`",
"description": "",
"description": "the amount to refund.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -510,7 +853,7 @@ Refund an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -530,7 +873,31 @@ ___
### retrievePayment
Retrieve an existing session
This method is used to provide a uniform way of retrieving the payment information from the third-party provider.
For example, in Stripes Payment Processor this method is used to retrieve the payment intent details from Stripe.
#### Example
```ts
import {
PaymentProcessorError
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
return await this.client.retrieve(paymentId)
}
}
```
#### Parameters
@@ -538,7 +905,7 @@ Retrieve an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment Session. Make sure to store in the `data` field any necessary data that would allow you to retrieve the payment data from the third-party provider.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -554,7 +921,7 @@ Retrieve an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The payment's data, typically retrieved from a third-party provider.",
"expandable": false,
"children": [
{
@@ -574,15 +941,50 @@ ___
### updatePayment
Update an existing payment session
This method is used to update the payment session when the payment amount changes. It's called whenever the cart or any of its related data is updated.
For example, when a [line item is added to the cart](https://docs.medusajs.com/api/store#carts\_postcartscartlineitems) or when a
[shipping method is selected](https://docs.medusajs.com/api/store#carts\_postcartscartshippingmethod).
#### Example
```ts
import {
PaymentProcessorContext,
PaymentProcessorError,
PaymentProcessorSessionResponse,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async updatePayment(
context: PaymentProcessorContext
): Promise<
void |
PaymentProcessorError |
PaymentProcessorSessionResponse
> {
// assuming client is an initialized client
// communicating with a third-party service.
const paymentId = context.paymentSessionData.id
await this.client.update(paymentId, context)
return {
session_data: context.paymentSessionData
}
}
}
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "context",
"type": "[PaymentProcessorContext](../types/medusa.PaymentProcessorContext.mdx)",
"description": "",
"type": "[PaymentProcessorContext](../interfaces/medusa.PaymentProcessorContext.mdx)",
"description": "The context of the payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -590,7 +992,7 @@ Update an existing payment session
{
"name": "amount",
"type": "`number`",
"description": "",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -598,8 +1000,8 @@ Update an existing payment session
},
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -608,7 +1010,7 @@ Update an existing payment session
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -617,7 +1019,7 @@ Update an existing payment session
{
"name": "currency_code",
"type": "`string`",
"description": "",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -626,7 +1028,7 @@ Update an existing payment session
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "A customer can make purchases in your store and manage their profile.",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -635,7 +1037,7 @@ Update an existing payment session
{
"name": "email",
"type": "`string`",
"description": "",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -644,7 +1046,7 @@ Update an existing payment session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -653,7 +1055,7 @@ Update an existing payment session
{
"name": "resource_id",
"type": "`string`",
"description": "",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -668,15 +1070,15 @@ Update an existing payment session
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"type": "Promise&#60;void \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either the payment's data or an error object.",
"expandable": false,
"children": [
{
"name": "void \\| PaymentProcessorError \\| PaymentProcessorSessionResponse",
"type": "`void` \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)",
"type": "`void` \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/medusa.PaymentProcessorSessionResponse.mdx)",
"optional": true,
"defaultValue": "",
"description": "",
@@ -691,7 +1093,48 @@ ___
### updatePaymentData
Update the session data for a payment session
This method is used to update the `data` field of a payment session. It's called when a request is sent to the
[Update Payment Session API Route](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsessionupdate), or when the `CartService`'s `updatePaymentSession` is used.
This method can also be used to update the data in the third-party payment provider, if necessary.
#### Example
```ts
import {
PaymentProcessorError,
PaymentProviderService,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
protected paymentProviderService: PaymentProviderService
// ...
constructor(container, options) {
super(container)
this.paymentProviderService = container.paymentProviderService
// ...
}
// ...
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
const paymentSession = await this.paymentProviderService.retrieveSession(sessionId)
// assuming client is an initialized client
// communicating with a third-party service.
const clientPayment = await this.client.update(paymentSession.data.id, data)
return {
id: clientPayment.id
}
}
}
```
#### Parameters
@@ -699,7 +1142,7 @@ Update the session data for a payment session
{
"name": "sessionId",
"type": "`string`",
"description": "",
"description": "The ID of the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -708,7 +1151,7 @@ Update the session data for a payment session
{
"name": "data",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The data to be updated in the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -724,7 +1167,7 @@ Update the session data for a payment session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](../interfaces/medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "the data to store in the `data` field of the payment session.\nYou can keep the data as-is, or make changes to it by communicating with the third-party provider.",
"expandable": false,
"children": [
{
@@ -1,32 +0,0 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# AdminGetRegionsPaginationParams
Parameters that can be used to configure how a list of data is paginated.
## Properties
<ParameterTypes parameters={[
{
"name": "limit",
"type": "`number`",
"description": "Limit the number of items returned in the list.",
"optional": true,
"defaultValue": "50",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "The number of items to skip when retrieving a list.",
"optional": true,
"defaultValue": "0",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -103,12 +103,30 @@ Parameters used to filter and configure the pagination of the retrieved regions.
}
]
},
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "Limit the number of items returned in the list.",
"optional": true,
"defaultValue": "50",
"defaultValue": "20",
"expandable": false,
"children": []
},
@@ -55,6 +55,34 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
"expandable": false,
"children": []
},
{
"name": "price_type",
"type": "[ShippingOptionPriceType](../../entities/enums/entities.ShippingOptionPriceType.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "CALCULATED",
"type": "`\"calculated\"`",
"description": "The shipping option's price is calculated. In this case, the `amount` field is typically `null`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "FLAT_RATE",
"type": "`\"flat_rate\"`",
"description": "The shipping option's price is a flat rate.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "requirements",
"type": "[OptionRequirement](medusa.OptionRequirement-1.mdx)[]",
@@ -29,7 +29,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "data",
"type": "`object`",
"type": "`Record<string, unknown>`",
"description": "The data needed for the Fulfillment Provider to handle shipping with this Shipping Option.",
"optional": false,
"defaultValue": "",
@@ -75,12 +75,31 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "price_type",
"type": "`string`",
"type": "[ShippingOptionPriceType](../../entities/enums/entities.ShippingOptionPriceType.mdx)",
"description": "The type of the Shipping Option price. `flat\\_rate` indicates fixed pricing, whereas `calculated` indicates that the price will be calculated each time by the fulfillment provider.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "CALCULATED",
"type": "`\"calculated\"`",
"description": "The shipping option's price is calculated. In this case, the `amount` field is typically `null`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "FLAT_RATE",
"type": "`\"flat_rate\"`",
"description": "The shipping option's price is a flat rate.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "profile_id",
@@ -128,7 +147,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "type",
"type": "`string`",
"type": "[RequirementType](../../entities/enums/entities.RequirementType.mdx)",
"description": "The type of the requirement",
"optional": false,
"defaultValue": "",
@@ -24,11 +24,30 @@ ___
},
{
"name": "type",
"type": "`string`",
"type": "[RequirementType](../../entities/enums/entities.RequirementType.mdx)",
"description": "The type of the requirement",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "MAX_SUBTOTAL",
"type": "`\"max_subtotal\"`",
"description": "The shipping option can only be applied if the subtotal is less than the requirement's amont.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "MIN_SUBTOTAL",
"type": "`\"min_subtotal\"`",
"description": "The shipping option can only be applied if the subtotal is greater than the requirement's amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -55,19 +55,37 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
}
]
},
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"description": "Limit the number of items returned in the list.",
"optional": true,
"defaultValue": "100",
"defaultValue": "20",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"description": "The number of items to skip when retrieving a list.",
"optional": true,
"defaultValue": "0",
"expandable": false,
@@ -0,0 +1,32 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# StoreGetRegionsRegionParams
Parameters that can be used to configure how data is retrieved.
## Properties
<ParameterTypes parameters={[
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,31 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductStatus
## Enumeration Members
### DRAFT
**DRAFT** = `"draft"`
___
### PROPOSED
**PROPOSED** = `"proposed"`
___
### PUBLISHED
**PUBLISHED** = `"published"`
___
### REJECTED
**REJECTED** = `"rejected"`
@@ -21,13 +21,15 @@ import { AbstractFulfillmentService } from "@medusajs/medusa"
class MyFulfillmentService extends AbstractFulfillmentService {
// methods here...
}
export default MyFulfillmentService
```
---
## Identifier Property
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the class is used when the fulfillment provider is created in the database.
The `FulfillmentProvider` entity has 2 properties: `identifier` and `is_installed`. The `identifier` property in the fulfillment provider service is used when the fulfillment provider is added to the database.
The value of this property is also used to reference the fulfillment provider throughout Medusa. For example, it is used to [add a fulfillment provider](https://docs.medusajs.com/api/admin#regions\_postregionsregionfulfillmentproviders) to a region.
@@ -185,7 +185,44 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "user",
"type": "`Object`",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "customer_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "userId",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "user.customer_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "user.userId",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
@@ -6,14 +6,167 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessor
The new payment service plugin interface
This work is still experimental and can be changed until it becomes stable
## Overview
A Payment Processor is the payment method used to authorize, capture, and refund payment, among other actions. An example of a Payment Processor is Stripe.
By default, Medusa has a `manual` payment provider that has minimal implementation. It can be synonymous with a Cash on Delivery payment method. It allows
store operators to manage the payment themselves but still keep track of its different stages on Medusa.
A payment processor is a service that extends the `AbstractPaymentProcessor` and implements its methods. So, adding a Payment Processor is as simple as
creating a service file in `src/services`. The file's name is the payment processor's class name as a slug and without the word `Service`.
For example, if you're creating a `MyPaymentService` class, the file name is `src/services/my-payment.ts`.
```ts
import { AbstractPaymentProcessor } from "@medusajs/medusa";
class MyPaymentService extends AbstractPaymentProcessor {
// methods here...
}
export default MyPaymentService
```
The methods of the payment processor are used at different points in the Checkout flow as well as when processing an order after its placed.
![Checkout Flow - Payment](https://res.cloudinary.com/dza7lstvk/image/upload/v1680177820/Medusa%20Docs/Diagrams/checkout-payment\_cy9efp.jpg)
---
## Identifier Property
The `PaymentProvider` entity has 2 properties: `id` and `is_installed`. The `identifier` property in the payment processor service is used when the payment processor is added to the database.
The value of this property is also used to reference the payment processor throughout Medusa.
For example, it is used to [add a payment processor](https://docs.medusajs.com/api/admin#regions\_postregionsregionpaymentproviders) to a region.
```ts
class MyPaymentService extends AbstractPaymentProcessor {
static identifier = "my-payment"
// ...
}
```
---
## PaymentProcessorError
Before diving into the methods of the Payment Processor, you'll notice that part of the expected return signature of these method includes `PaymentProcessorError`.
```ts
interface PaymentProcessorError {
error: string
code?: string
detail?: any
}
```
While implementing the Payment Processor's methods, if you need to inform the Medusa core that an error occurred at a certain stage,
return an object having the attributes defined in the `PaymentProcessorError` interface.
For example, the Stripe payment processor has the following method to create the error object, which is used within other methods:
```ts
abstract class StripeBase extends AbstractPaymentProcessor {
// ...
protected buildError(
message: string,
e: Stripe.StripeRawError | PaymentProcessorError | Error
): PaymentProcessorError {
return {
error: message,
code: "code" in e ? e.code : "",
detail: isPaymentProcessorError(e)
? `${e.error}${EOL}${e.detail ?? ""}`
: "detail" in e
? e.detail
: e.message ?? "",
}
}
// used in other methods
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<
PaymentProcessorError |
PaymentProcessorSessionResponse["session_data"]
> {
try {
// ...
} catch (e) {
return this.buildError(
"An error occurred in retrievePayment",
e
)
}
}
}
```
---
## Methods
### authorizePayment
Authorize an existing session if it is not already authorized
This method is used to authorize payment using the Payment Session of an order. This is called when the
[cart is completed](https://docs.medusajs.com/api/store#carts\_postcartscartcomplete) and before the order is created.
This method is also used for authorizing payments of a swap of an order and when authorizing sessions in a payment collection.
You can interact with a third-party provider and perform any actions necessary to authorize the payment.
The payment authorization might require additional action from the customer before it is declared authorized. Once that additional action is performed,
the `authorizePayment` method will be called again to validate that the payment is now fully authorized. So, make sure to implement it for this case as well, if necessary.
Once the payment is authorized successfully and the Payment Session status is set to `authorized`, the associated order or swap can then be placed or created.
If the payment authorization fails, then an error will be thrown and the order will not be created.
:::note
The payment authorization status is determined using the [getPaymentStatus](medusa.PaymentProcessor.mdx#getpaymentstatus) method. If the status is `requires_more`, then it means additional actions are required
from the customer. If you try to create the order with a status that isn't `authorized`, the process will fail.
:::
#### Example
```ts
import {
PaymentProcessorError,
PaymentSessionStatus,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async authorizePayment(
paymentSessionData: Record<string, unknown>,
context: Record<string, unknown>
): Promise<
PaymentProcessorError |
{
status: PaymentSessionStatus;
data: Record<string, unknown>;
}
> {
try {
await this.client.authorize(paymentSessionData.id)
return {
status: PaymentSessionStatus.AUTHORIZED,
data: {
id: paymentSessionData.id
}
}
} catch (e) {
return {
error: e.message
}
}
}
}
```
#### Parameters
@@ -21,7 +174,7 @@ Authorize an existing session if it is not already authorized
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -30,7 +183,7 @@ Authorize an existing session if it is not already authorized
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The context of the authorization. It may include some of the following fields:\n\n- `ip`: The customers IP.\n- `idempotency_key`: The [Idempotency Key](https://docs.medusajs.com/modules/carts-and-checkout/payment#idempotency-key) that is associated with the current cart. It is useful when retrying payments, retrying checkout at a failed point, or for payments that require additional actions from the customer.\n- `cart_id`: The ID of a cart. This is only during operations like placing an order or creating a swap.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -46,7 +199,7 @@ Authorize an existing session if it is not already authorized
"type": "Promise&#60;[PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| object&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The authorization details or an error object.",
"expandable": false,
"children": [
{
@@ -66,7 +219,41 @@ ___
### cancelPayment
Cancel an existing session
This method is used to cancel an orders payment. This method is typically triggered by one of the following situations:
1. Before an order is placed and after the payment is authorized, an inventory check is done on products to ensure that products are still available for purchase. If the inventory check fails for any of the products, the payment is canceled.
2. If the store operator cancels the order from the admin.
3. When the payment of an order's swap is canceled.
You can utilize this method to interact with the third-party provider and perform any actions necessary to cancel the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async cancelPayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const cancelData = this.client.cancel(paymentId)
return {
id: paymentId,
...cancelData
}
}
}
```
#### Parameters
@@ -74,7 +261,7 @@ Cancel an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -90,7 +277,7 @@ Cancel an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -110,7 +297,39 @@ ___
### capturePayment
Capture an existing session
This method is used to capture the payment amount of an order. This is typically triggered manually by the store operator from the admin.
This method is also used for capturing payments of a swap of an order, or when a request is sent to the [Capture Payment API Route](https://docs.medusajs.com/api/admin#payments\_postpaymentspaymentcapture).
You can utilize this method to interact with the third-party provider and perform any actions necessary to capture the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async capturePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const captureData = this.client.catch(paymentId)
return {
id: paymentId,
...captureData
}
}
}
```
#### Parameters
@@ -118,7 +337,7 @@ Capture an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment for its first parameter.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -134,7 +353,7 @@ Capture an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -154,7 +373,36 @@ ___
### deletePayment
Delete an existing session
This method is used to perform any actions necessary before a Payment Session is deleted. The Payment Session is deleted in one of the following cases:
1. When a request is sent to [delete the Payment Session](https://docs.medusajs.com/api/store#carts\_deletecartscartpaymentsessionssession).
2. When the [Payment Session is refreshed](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsessionssession). The Payment Session is deleted so that a newer one is initialized instead.
3. When the Payment Processor is no longer available. This generally happens when the store operator removes it from the available Payment Processor in the admin.
4. When the region of the store is changed based on the cart information and the Payment Processor is not available in the new region.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async deletePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
this.client.delete(paymentId)
return {}
}
}
```
#### Parameters
@@ -162,7 +410,7 @@ Delete an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of the Payment Session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -178,7 +426,7 @@ Delete an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or an empty object.",
"expandable": false,
"children": [
{
@@ -196,29 +444,33 @@ Delete an existing session
___
### getIdentifier
Return a unique identifier to retrieve the payment plugin provider
#### Returns
<ParameterTypes parameters={[
{
"name": "string",
"type": "`string`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### getPaymentStatus
Return the status of the session
This method is used to get the status of a Payment or a Payment Session. Its main usage is within the place order and create swap flows.
If the status returned is not `authorized` within these flows, then the payment is considered failed and an error will be thrown, stopping the flow from completion.
#### Example
```ts
import {
PaymentSessionStatus
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async getPaymentStatus(
paymentSessionData: Record<string, unknown>
): Promise<PaymentSessionStatus> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
return await this.client.getStatus(paymentId) as PaymentSessionStatus
}
}
```
#### Parameters
@@ -226,7 +478,7 @@ Return the status of the session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment as a parameter. You can use this data to interact with the third-party provider to check the status of the payment if necessary.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -242,7 +494,7 @@ Return the status of the session
"type": "Promise&#60;[PaymentSessionStatus](../../entities/enums/entities.PaymentSessionStatus.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The status of the Payment or Payment Session.",
"expandable": false,
"children": [
{
@@ -262,15 +514,47 @@ ___
### initiatePayment
Initiate a payment session with the external provider
This method is called either if a region has only one payment provider enabled or when [a Payment Session is selected](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsession),
which occurs when the customer selects their preferred payment method during checkout.
It is used to allow you to make any necessary calls to the third-party provider to initialize the payment. For example, in Stripe this method is used to create a Payment Intent for the customer.
#### Example
```ts
import {
PaymentContext,
PaymentSessionResponse,
// ...
} from "@medusajs/medusa"
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async initiatePayment(
context: PaymentProcessorContext
): Promise<
PaymentProcessorError | PaymentProcessorSessionResponse
> {
// assuming client is an initialized client
// communicating with a third-party service.
const clientPayment = await this.client.initiate(context)
return {
session_data: {
id: clientPayment.id
},
}
}
}
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "context",
"type": "[PaymentProcessorContext](../types/medusa.PaymentProcessorContext.mdx)",
"description": "",
"type": "[PaymentProcessorContext](medusa.PaymentProcessorContext.mdx)",
"description": "The context of the payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -278,7 +562,7 @@ Initiate a payment session with the external provider
{
"name": "amount",
"type": "`number`",
"description": "",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -286,8 +570,8 @@ Initiate a payment session with the external provider
},
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -296,7 +580,7 @@ Initiate a payment session with the external provider
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -305,7 +589,7 @@ Initiate a payment session with the external provider
{
"name": "currency_code",
"type": "`string`",
"description": "",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -314,7 +598,7 @@ Initiate a payment session with the external provider
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "A customer can make purchases in your store and manage their profile.",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -323,7 +607,7 @@ Initiate a payment session with the external provider
{
"name": "email",
"type": "`string`",
"description": "",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -332,7 +616,7 @@ Initiate a payment session with the external provider
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -341,7 +625,7 @@ Initiate a payment session with the external provider
{
"name": "resource_id",
"type": "`string`",
"description": "",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -356,15 +640,15 @@ Initiate a payment session with the external provider
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"type": "Promise&#60;[PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either the payment's data or an error object.",
"expandable": false,
"children": [
{
"name": "PaymentProcessorError \\| PaymentProcessorSessionResponse",
"type": "[PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)",
"type": "[PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](medusa.PaymentProcessorSessionResponse.mdx)",
"optional": true,
"defaultValue": "",
"description": "",
@@ -379,7 +663,40 @@ ___
### refundPayment
Refund an existing session
This method is used to refund an orders payment. This is typically triggered manually by the store operator from the admin. The refund amount might be the total order amount or part of it.
This method is also used for refunding payments of a swap or a claim of an order, or when a request is sent to the [Refund Payment API Route](https://docs.medusajs.com/api/admin#payments\_postpaymentspaymentrefunds).
You can utilize this method to interact with the third-party provider and perform any actions necessary to refund the payment.
#### Example
```ts
import {
PaymentProcessorError,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async refundPayment(
paymentSessionData: Record<string, unknown>,
refundAmount: number
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
const refundData = this.client.refund(paymentId, refundAmount)
return {
id: paymentId,
...refundData
}
}
}
```
#### Parameters
@@ -387,7 +704,7 @@ Refund an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -396,7 +713,7 @@ Refund an existing session
{
"name": "refundAmount",
"type": "`number`",
"description": "",
"description": "the amount to refund.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -412,7 +729,7 @@ Refund an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either an error object or a value that's stored in the `data` field of the Payment.",
"expandable": false,
"children": [
{
@@ -432,7 +749,31 @@ ___
### retrievePayment
Retrieve an existing session
This method is used to provide a uniform way of retrieving the payment information from the third-party provider.
For example, in Stripes Payment Processor this method is used to retrieve the payment intent details from Stripe.
#### Example
```ts
import {
PaymentProcessorError
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async retrievePayment(
paymentSessionData: Record<string, unknown>
): Promise<Record<string, unknown> | PaymentProcessorError> {
const paymentId = paymentSessionData.id
// assuming client is an initialized client
// communicating with a third-party service.
return await this.client.retrieve(paymentId)
}
}
```
#### Parameters
@@ -440,7 +781,7 @@ Retrieve an existing session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The `data` field of a Payment Session. Make sure to store in the `data` field any necessary data that would allow you to retrieve the payment data from the third-party provider.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -456,7 +797,7 @@ Retrieve an existing session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "The payment's data, typically retrieved from a third-party provider.",
"expandable": false,
"children": [
{
@@ -476,15 +817,50 @@ ___
### updatePayment
Update an existing payment session
This method is used to update the payment session when the payment amount changes. It's called whenever the cart or any of its related data is updated.
For example, when a [line item is added to the cart](https://docs.medusajs.com/api/store#carts\_postcartscartlineitems) or when a
[shipping method is selected](https://docs.medusajs.com/api/store#carts\_postcartscartshippingmethod).
#### Example
```ts
import {
PaymentProcessorContext,
PaymentProcessorError,
PaymentProcessorSessionResponse,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async updatePayment(
context: PaymentProcessorContext
): Promise<
void |
PaymentProcessorError |
PaymentProcessorSessionResponse
> {
// assuming client is an initialized client
// communicating with a third-party service.
const paymentId = context.paymentSessionData.id
await this.client.update(paymentId, context)
return {
session_data: context.paymentSessionData
}
}
}
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "context",
"type": "[PaymentProcessorContext](../types/medusa.PaymentProcessorContext.mdx)",
"description": "",
"type": "[PaymentProcessorContext](medusa.PaymentProcessorContext.mdx)",
"description": "The context of the payment.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -492,7 +868,7 @@ Update an existing payment session
{
"name": "amount",
"type": "`number`",
"description": "",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -500,8 +876,8 @@ Update an existing payment session
},
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -510,7 +886,7 @@ Update an existing payment session
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -519,7 +895,7 @@ Update an existing payment session
{
"name": "currency_code",
"type": "`string`",
"description": "",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -528,7 +904,7 @@ Update an existing payment session
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "A customer can make purchases in your store and manage their profile.",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -537,7 +913,7 @@ Update an existing payment session
{
"name": "email",
"type": "`string`",
"description": "",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -546,7 +922,7 @@ Update an existing payment session
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -555,7 +931,7 @@ Update an existing payment session
{
"name": "resource_id",
"type": "`string`",
"description": "",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -570,15 +946,15 @@ Update an existing payment session
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"type": "Promise&#60;void \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](medusa.PaymentProcessorSessionResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "Either the payment's data or an error object.",
"expandable": false,
"children": [
{
"name": "void \\| PaymentProcessorError \\| PaymentProcessorSessionResponse",
"type": "`void` \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../types/medusa.PaymentProcessorSessionResponse.mdx)",
"type": "`void` \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](medusa.PaymentProcessorSessionResponse.mdx)",
"optional": true,
"defaultValue": "",
"description": "",
@@ -593,7 +969,48 @@ ___
### updatePaymentData
Update the session data for a payment session
This method is used to update the `data` field of a payment session. It's called when a request is sent to the
[Update Payment Session API Route](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsessionupdate), or when the `CartService`'s `updatePaymentSession` is used.
This method can also be used to update the data in the third-party payment provider, if necessary.
#### Example
```ts
import {
PaymentProcessorError,
PaymentProviderService,
// ...
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
protected paymentProviderService: PaymentProviderService
// ...
constructor(container, options) {
super(container)
this.paymentProviderService = container.paymentProviderService
// ...
}
// ...
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
const paymentSession = await this.paymentProviderService.retrieveSession(sessionId)
// assuming client is an initialized client
// communicating with a third-party service.
const clientPayment = await this.client.update(paymentSession.data.id, data)
return {
id: clientPayment.id
}
}
}
```
#### Parameters
@@ -601,7 +1018,7 @@ Update the session data for a payment session
{
"name": "sessionId",
"type": "`string`",
"description": "",
"description": "The ID of the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -610,7 +1027,7 @@ Update the session data for a payment session
{
"name": "data",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The data to be updated in the payment session.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -626,7 +1043,7 @@ Update the session data for a payment session
"type": "Promise&#60;Record&#60;string, unknown&#62; \\| [PaymentProcessorError](medusa.PaymentProcessorError.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"description": "the data to store in the `data` field of the payment session.\nYou can keep the data as-is, or make changes to it by communicating with the third-party provider.",
"expandable": false,
"children": [
{
@@ -6,15 +6,15 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorContext
**PaymentProcessorContext**: `Object`
A payment's context.
## Type declaration
## Properties
<ParameterTypes parameters={[
{
"name": "amount",
"type": "`number`",
"description": "",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -22,8 +22,8 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -32,7 +32,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -41,7 +41,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "currency_code",
"type": "`string`",
"description": "",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -50,7 +50,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "A customer can make purchases in your store and manage their profile.",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -204,7 +204,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "email",
"type": "`string`",
"description": "",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -213,7 +213,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -222,10 +222,10 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "resource_id",
"type": "`string`",
"description": "",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -6,13 +6,15 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorError
An object that is returned in case of an error.
## Properties
<ParameterTypes parameters={[
{
"name": "code",
"type": "`string`",
"description": "",
"description": "The error code.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -21,7 +23,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "detail",
"type": "`any`",
"description": "",
"description": "Any additional helpful details.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -30,7 +32,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "error",
"type": "`string`",
"description": "",
"description": "The error message",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -0,0 +1,51 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorSessionResponse
The response of operations on a payment.
## Properties
<ParameterTypes parameters={[
{
"name": "session_data",
"type": "`Record<string, unknown>`",
"description": "The data to be stored in the `data` field of the Payment Session to be created.\nThe `data` field is useful to hold any data required by the third-party provider to process the payment or retrieve its details at a later point.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "update_requests",
"type": "`object`",
"description": "Used to specify data that should be updated in the Medusa backend.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "customer_metadata",
"type": "`Record<string, unknown>`",
"description": "Specifies a new value of the `metadata` field of the customer associated with the payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "update_requests.customer_metadata",
"type": "`Record<string, unknown>`",
"description": "Specifies a new value of the `metadata` field of the customer associated with the payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,313 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductCategoryDTO
A product category's data.
## Properties
<ParameterTypes parameters={[
{
"name": "category_children",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated child categories.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "category_children",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated child categories.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product category was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "The description of the product category.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "The handle of the product category. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_active",
"type": "`boolean`",
"description": "Whether the product category is active.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_internal",
"type": "`boolean`",
"description": "Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The name of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "parent_category",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)",
"description": "The associated parent category.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rank",
"type": "`number`",
"description": "The ranking of the product category among sibling categories.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product category was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product category was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "The description of the product category.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "The handle of the product category. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_active",
"type": "`boolean`",
"description": "Whether the product category is active.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_internal",
"type": "`boolean`",
"description": "Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The name of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "parent_category",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)",
"description": "The associated parent category.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "category_children",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated child categories.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product category was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "The description of the product category.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "The handle of the product category. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_active",
"type": "`boolean`",
"description": "Whether the product category is active.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "is_internal",
"type": "`boolean`",
"description": "Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The name of the product category.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "parent_category",
"type": "[ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)",
"description": "The associated parent category.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rank",
"type": "`number`",
"description": "The ranking of the product category among sibling categories.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product category was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rank",
"type": "`number`",
"description": "The ranking of the product category among sibling categories.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product category was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,330 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductCollectionDTO
A product collection's data.
## Properties
<ParameterTypes parameters={[
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product collection was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "The handle of the product collection. The handle can be used to create slug URL paths.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[ProductDTO](medusa.ProductDTO.mdx)[]",
"description": "The associated products.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "categories",
"type": "`null` \\| [ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated product categories.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "collection",
"type": "[ProductCollectionDTO](medusa.ProductCollectionDTO.mdx)",
"description": "The associated product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product was created.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discountable",
"type": "`boolean`",
"description": "Whether the product can be discounted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`null` \\| `string`",
"description": "The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain\na reference to the ID in the integrated service.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`null` \\| `string`",
"description": "The handle of the product. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "images",
"type": "[ProductImageDTO](medusa.ProductImageDTO.mdx)[]",
"description": "The associated product images.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "is_giftcard",
"type": "`boolean`",
"description": "Whether the product is a gift card.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[ProductStatus](../enums/medusa.ProductStatus.mdx)",
"description": "The status of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subtitle",
"type": "`null` \\| `string`",
"description": "The subttle of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tags",
"type": "[ProductTagDTO](medusa.ProductTagDTO.mdx)[]",
"description": "The associated product tags.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The URL of the product's thumbnail.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[ProductTypeDTO](medusa.ProductTypeDTO.mdx)[]",
"description": "The associated product type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product was updated.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)[]",
"description": "The associated product variants.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,759 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductDTO
A product's data.
## Properties
<ParameterTypes parameters={[
{
"name": "categories",
"type": "`null` \\| [ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated product categories.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "collection",
"type": "[ProductCollectionDTO](medusa.ProductCollectionDTO.mdx)",
"description": "The associated product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product collection was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "The handle of the product collection. The handle can be used to create slug URL paths.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[ProductDTO](medusa.ProductDTO.mdx)[]",
"description": "The associated products.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product was created.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discountable",
"type": "`boolean`",
"description": "Whether the product can be discounted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`null` \\| `string`",
"description": "The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain\na reference to the ID in the integrated service.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`null` \\| `string`",
"description": "The handle of the product. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "images",
"type": "[ProductImageDTO](medusa.ProductImageDTO.mdx)[]",
"description": "The associated product images.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product image was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product image.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "url",
"type": "`string`",
"description": "The URL of the product image.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "is_giftcard",
"type": "`boolean`",
"description": "Whether the product is a gift card.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "values",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product option values.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[ProductStatus](../enums/medusa.ProductStatus.mdx)",
"description": "The status of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "PROPOSED",
"type": "`\"proposed\"`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "PUBLISHED",
"type": "`\"published\"`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "REJECTED",
"type": "`\"rejected\"`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "subtitle",
"type": "`null` \\| `string`",
"description": "The subttle of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tags",
"type": "[ProductTagDTO](medusa.ProductTagDTO.mdx)[]",
"description": "The associated product tags.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of the product tag.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[ProductDTO](medusa.ProductDTO.mdx)[]",
"description": "The associated products.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product tag.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The URL of the product's thumbnail.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[ProductTypeDTO](medusa.ProductTypeDTO.mdx)[]",
"description": "The associated product type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product type was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product was updated.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)[]",
"description": "The associated product variants.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "allow_backorder",
"type": "`boolean`",
"description": "Whether the product variant can be ordered when it's out of stock.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "barcode",
"type": "`null` \\| `string`",
"description": "The barcode of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ean",
"type": "`null` \\| `string`",
"description": "The EAN of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number`",
"description": "The inventory quantiy of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manage_inventory",
"type": "`boolean`",
"description": "Whether the product variant's inventory should be managed by the core system.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_id",
"type": "`string`",
"description": "The ID of the associated product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`null` \\| `string`",
"description": "The SKU of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The tile of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "upc",
"type": "`null` \\| `string`",
"description": "The UPC of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_rank",
"type": "`null` \\| `number`",
"description": "he ranking of the variant among other variants associated with the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,50 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductImageDTO
The product image's data.
## Properties
<ParameterTypes parameters={[
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product image was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product image.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "url",
"type": "`string`",
"description": "The URL of the product image.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,385 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductOptionDTO
A product option's data.
## Properties
<ParameterTypes parameters={[
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "categories",
"type": "`null` \\| [ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated product categories.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "collection",
"type": "[ProductCollectionDTO](medusa.ProductCollectionDTO.mdx)",
"description": "The associated product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product was created.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discountable",
"type": "`boolean`",
"description": "Whether the product can be discounted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`null` \\| `string`",
"description": "The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain\na reference to the ID in the integrated service.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`null` \\| `string`",
"description": "The handle of the product. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "images",
"type": "[ProductImageDTO](medusa.ProductImageDTO.mdx)[]",
"description": "The associated product images.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "is_giftcard",
"type": "`boolean`",
"description": "Whether the product is a gift card.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[ProductStatus](../enums/medusa.ProductStatus.mdx)",
"description": "The status of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subtitle",
"type": "`null` \\| `string`",
"description": "The subttle of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tags",
"type": "[ProductTagDTO](medusa.ProductTagDTO.mdx)[]",
"description": "The associated product tags.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The URL of the product's thumbnail.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[ProductTypeDTO](medusa.ProductTypeDTO.mdx)[]",
"description": "The associated product type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product was updated.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)[]",
"description": "The associated product variants.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "values",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product option values.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option value was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "option",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)",
"description": "The associated product option. It may only be available if the `option` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)",
"description": "The associated product variant. It may only be available if the `variant` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,349 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductOptionValueDTO
The product option value's data.
## Properties
<ParameterTypes parameters={[
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option value was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "option",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)",
"description": "The associated product option. It may only be available if the `option` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product option.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "values",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product option values.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)",
"description": "The associated product variant. It may only be available if the `variant` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "allow_backorder",
"type": "`boolean`",
"description": "Whether the product variant can be ordered when it's out of stock.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "barcode",
"type": "`null` \\| `string`",
"description": "The barcode of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ean",
"type": "`null` \\| `string`",
"description": "The EAN of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number`",
"description": "The inventory quantiy of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manage_inventory",
"type": "`boolean`",
"description": "Whether the product variant's inventory should be managed by the core system.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_id",
"type": "`string`",
"description": "The ID of the associated product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`null` \\| `string`",
"description": "The SKU of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The tile of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "upc",
"type": "`null` \\| `string`",
"description": "The UPC of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_rank",
"type": "`null` \\| `number`",
"description": "he ranking of the variant among other variants associated with the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,312 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductTagDTO
A product tag's data.
## Properties
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the product tag.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[ProductDTO](medusa.ProductDTO.mdx)[]",
"description": "The associated products.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "categories",
"type": "`null` \\| [ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated product categories.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "collection",
"type": "[ProductCollectionDTO](medusa.ProductCollectionDTO.mdx)",
"description": "The associated product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product was created.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discountable",
"type": "`boolean`",
"description": "Whether the product can be discounted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`null` \\| `string`",
"description": "The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain\na reference to the ID in the integrated service.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`null` \\| `string`",
"description": "The handle of the product. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "images",
"type": "[ProductImageDTO](medusa.ProductImageDTO.mdx)[]",
"description": "The associated product images.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "is_giftcard",
"type": "`boolean`",
"description": "Whether the product is a gift card.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[ProductStatus](../enums/medusa.ProductStatus.mdx)",
"description": "The status of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subtitle",
"type": "`null` \\| `string`",
"description": "The subttle of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tags",
"type": "[ProductTagDTO](medusa.ProductTagDTO.mdx)[]",
"description": "The associated product tags.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The URL of the product's thumbnail.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[ProductTypeDTO](medusa.ProductTypeDTO.mdx)[]",
"description": "The associated product type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product was updated.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)[]",
"description": "The associated product variants.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product tag.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,50 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductTypeDTO
A product type's data.
## Properties
<ParameterTypes parameters={[
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product type was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -0,0 +1,556 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProductVariantDTO
A product variant's data.
## Properties
<ParameterTypes parameters={[
{
"name": "allow_backorder",
"type": "`boolean`",
"description": "Whether the product variant can be ordered when it's out of stock.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "barcode",
"type": "`null` \\| `string`",
"description": "The barcode of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ean",
"type": "`null` \\| `string`",
"description": "The EAN of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number`",
"description": "The inventory quantiy of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manage_inventory",
"type": "`boolean`",
"description": "Whether the product variant's inventory should be managed by the core system.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionValueDTO](medusa.ProductOptionValueDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product option value was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "option",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)",
"description": "The associated product option. It may only be available if the `option` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the product option value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)",
"description": "The associated product variant. It may only be available if the `variant` relation is expanded.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product",
"type": "[ProductDTO](medusa.ProductDTO.mdx)",
"description": "The associated product.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "categories",
"type": "`null` \\| [ProductCategoryDTO](medusa.ProductCategoryDTO.mdx)[]",
"description": "The associated product categories.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "collection",
"type": "[ProductCollectionDTO](medusa.ProductCollectionDTO.mdx)",
"description": "The associated product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "When the product was created.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date`",
"description": "When the product was deleted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discountable",
"type": "`boolean`",
"description": "Whether the product can be discounted.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`null` \\| `string`",
"description": "The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain\na reference to the ID in the integrated service.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`null` \\| `string`",
"description": "The handle of the product. The handle can be used to create slug URL paths.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "images",
"type": "[ProductImageDTO](medusa.ProductImageDTO.mdx)[]",
"description": "The associated product images.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "is_giftcard",
"type": "`boolean`",
"description": "Whether the product is a gift card.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID Code of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[ProductOptionDTO](medusa.ProductOptionDTO.mdx)[]",
"description": "The associated product options.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[ProductStatus](../enums/medusa.ProductStatus.mdx)",
"description": "The status of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subtitle",
"type": "`null` \\| `string`",
"description": "The subttle of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tags",
"type": "[ProductTagDTO](medusa.ProductTagDTO.mdx)[]",
"description": "The associated product tags.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The URL of the product's thumbnail.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[ProductTypeDTO](medusa.ProductTypeDTO.mdx)[]",
"description": "The associated product type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product was updated.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[ProductVariantDTO](medusa.ProductVariantDTO.mdx)[]",
"description": "The associated product variants.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "product_id",
"type": "`string`",
"description": "The ID of the associated product.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`null` \\| `string`",
"description": "The SKU of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The tile of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "upc",
"type": "`null` \\| `string`",
"description": "The UPC of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "When the product variant was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_rank",
"type": "`null` \\| `number`",
"description": "he ranking of the variant among other variants associated with the product.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
@@ -40,114 +40,5 @@ Details of inventory items and their associated location levels.
"children": []
}
]
},
{
"name": "inventory_item.id",
"type": "`any`",
"description": "The id of the location",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item.location_levels",
"type": "[InventoryLevelDTO](medusa.InventoryLevelDTO.mdx)[]",
"description": "List of stock levels at a given location",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date` \\| `null`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "incoming_quantity",
"type": "`number`",
"description": "the incoming stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "the item location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "reserved_quantity",
"type": "`number`",
"description": "the reserved stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stocked_quantity",
"type": "`number`",
"description": "the total stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -18,7 +18,7 @@ The fields returned in the response of a DELETE request.
"type": "`boolean`",
"description": "Whether the item was deleted successfully.",
"optional": false,
"defaultValue": "",
"defaultValue": "true",
"expandable": false,
"children": []
},
@@ -36,7 +36,7 @@ The fields returned in the response of a DELETE request.
"type": "`string`",
"description": "The type of the item that was deleted.",
"optional": false,
"defaultValue": "",
"defaultValue": "stock_location",
"expandable": false,
"children": []
}
@@ -183,32 +183,5 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
"children": []
}
]
},
{
"name": "server.keepAlive",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "server.type",
"type": "`\"http\"`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "server.url",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -0,0 +1,23 @@
---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# InnerSelector
**InnerSelector**: &#123; [key in keyof TEntity]?: TEntity[key] \| TEntity[key][] \| DateComparisonOperator \| StringComparisonOperator \| NumericalComparisonOperator \| FindOperator&#60;TEntity[key][] \| string \| string[]&#62; &#125;
## Type Parameters
<ParameterTypes parameters={[
{
"name": "TEntity",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -95,7 +95,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "user",
"type": "`Object`",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
@@ -86,7 +86,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
},
{
"name": "user",
"type": "`Object`",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
@@ -14,7 +14,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "count",
"type": "`number`",
"description": "",
"description": "The total number of notifications",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -23,7 +23,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "limit",
"type": "`number`",
"description": "",
"description": "The number of notifications per page",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -32,7 +32,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "offset",
"type": "`number`",
"description": "",
"description": "The number of notifications skipped when retrieving the notifications.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -84,242 +84,6 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
}
]
},
{
"name": "cart.billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cart.context",
"type": "`Record<string, unknown>`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cart.email",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cart.id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cart.shipping_address",
"type": "[Address](../../entities/classes/entities.Address.mdx) \\| `null`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cart.shipping_methods",
"type": "[ShippingMethod](../../entities/classes/entities.ShippingMethod.mdx)[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "cart",
"type": "[Cart](../../entities/classes/entities.Cart.mdx)",
"description": "The details of the cart that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "cart_id",
"type": "`string`",
"description": "The ID of the cart that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "claim_order",
"type": "[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)",
"description": "The details of the claim that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "claim_order_id",
"type": "`null` \\| `string`",
"description": "The ID of the claim that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "data",
"type": "`Record<string, unknown>`",
"description": "Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The shipping method's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "includes_tax",
"type": "`boolean`",
"description": "Whether the shipping method price include tax",
"optional": false,
"defaultValue": "false",
"expandable": false,
"featureFlag": "tax_inclusive_pricing",
"children": []
},
{
"name": "order",
"type": "[Order](../../entities/classes/entities.Order.mdx)",
"description": "The details of the order that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "order_id",
"type": "`string`",
"description": "The ID of the order that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price",
"type": "`number`",
"description": "The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "return_id",
"type": "`string`",
"description": "The ID of the return that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "return_order",
"type": "[Return](../../entities/classes/entities.Return.mdx)",
"description": "The details of the return that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "shipping_option",
"type": "[ShippingOption](../../entities/classes/entities.ShippingOption.mdx)",
"description": "The details of the shipping option the method was created from.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "shipping_option_id",
"type": "`string`",
"description": "The ID of the Shipping Option that the Shipping Method is built from.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subtotal",
"type": "`number`",
"description": "The subtotal of the shipping",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "swap",
"type": "[Swap](../../entities/classes/entities.Swap.mdx)",
"description": "The details of the swap that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "swap_id",
"type": "`string`",
"description": "The ID of the swap that the shipping method is used in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tax_lines",
"type": "[ShippingMethodTaxLine](../../entities/classes/entities.ShippingMethodTaxLine.mdx)[]",
"description": "The details of the tax lines applied on the shipping method.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "tax_total",
"type": "`number`",
"description": "The total of tax",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "total",
"type": "`number`",
"description": "The total amount of the shipping",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "currency_code",
"type": "`string`",
@@ -38,14 +38,5 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
"children": []
}
]
},
{
"name": "update_requests.customer_metadata",
"type": "`Record<string, unknown>`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -6,7 +6,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
# Selector
**Selector**: &#123; [key in keyof TEntity]?: TEntity[key] \| TEntity[key][] \| DateComparisonOperator \| StringComparisonOperator \| NumericalComparisonOperator \| FindOperator&#60;TEntity[key][] \| string \| string[]&#62; &#125;
**Selector**: [InnerSelector](medusa.InnerSelector.mdx)&#60;TEntity&#62; \| [InnerSelector](medusa.InnerSelector.mdx)&#60;TEntity&#62;[]
## Type Parameters
@@ -16,6 +16,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [PriceListStatus](../medusa/enums/medusa.PriceListStatus-1.mdx)
- [PriceListType](../medusa/enums/medusa.PriceListType.mdx)
- [PriceListType](../medusa/enums/medusa.PriceListType-1.mdx)
- [ProductStatus](../medusa/enums/medusa.ProductStatus.mdx)
## Classes
@@ -87,7 +88,6 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [AdminGetProductTypesParams](../medusa/classes/medusa.AdminGetProductTypesParams.mdx)
- [AdminGetProductsParams](../medusa/classes/medusa.AdminGetProductsParams.mdx)
- [AdminGetProductsVariantsParams](../medusa/classes/medusa.AdminGetProductsVariantsParams.mdx)
- [AdminGetRegionsPaginationParams](../medusa/classes/medusa.AdminGetRegionsPaginationParams.mdx)
- [AdminGetRegionsParams](../medusa/classes/medusa.AdminGetRegionsParams.mdx)
- [AdminGetRegionsRegionFulfillmentOptionsRes](../medusa/classes/medusa.AdminGetRegionsRegionFulfillmentOptionsRes.mdx)
- [AdminGetReservationsParams](../medusa/classes/medusa.AdminGetReservationsParams.mdx)
@@ -333,6 +333,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [StoreGetProductsPaginationParams](../medusa/classes/medusa.StoreGetProductsPaginationParams.mdx)
- [StoreGetProductsParams](../medusa/classes/medusa.StoreGetProductsParams.mdx)
- [StoreGetRegionsParams](../medusa/classes/medusa.StoreGetRegionsParams.mdx)
- [StoreGetRegionsRegionParams](../medusa/classes/medusa.StoreGetRegionsRegionParams.mdx)
- [StoreGetShippingOptionsParams](../medusa/classes/medusa.StoreGetShippingOptionsParams.mdx)
- [StoreGetVariantsParams](../medusa/classes/medusa.StoreGetVariantsParams.mdx)
- [StoreGetVariantsVariantParams](../medusa/classes/medusa.StoreGetVariantsVariantParams.mdx)
@@ -383,8 +384,19 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [MedusaRequest](../medusa/interfaces/medusa.MedusaRequest.mdx)
- [PaginatedResponse](../medusa/interfaces/medusa.PaginatedResponse.mdx)
- [PaymentProcessor](../medusa/interfaces/medusa.PaymentProcessor.mdx)
- [PaymentProcessorContext](../medusa/interfaces/medusa.PaymentProcessorContext.mdx)
- [PaymentProcessorError](../medusa/interfaces/medusa.PaymentProcessorError.mdx)
- [PaymentProcessorSessionResponse](../medusa/interfaces/medusa.PaymentProcessorSessionResponse.mdx)
- [PaymentService](../medusa/interfaces/medusa.PaymentService.mdx)
- [ProductCategoryDTO](../medusa/interfaces/medusa.ProductCategoryDTO.mdx)
- [ProductCollectionDTO](../medusa/interfaces/medusa.ProductCollectionDTO.mdx)
- [ProductDTO](../medusa/interfaces/medusa.ProductDTO.mdx)
- [ProductImageDTO](../medusa/interfaces/medusa.ProductImageDTO.mdx)
- [ProductOptionDTO](../medusa/interfaces/medusa.ProductOptionDTO.mdx)
- [ProductOptionValueDTO](../medusa/interfaces/medusa.ProductOptionValueDTO.mdx)
- [ProductTagDTO](../medusa/interfaces/medusa.ProductTagDTO.mdx)
- [ProductTypeDTO](../medusa/interfaces/medusa.ProductTypeDTO.mdx)
- [ProductVariantDTO](../medusa/interfaces/medusa.ProductVariantDTO.mdx)
- [RequestQueryFields](../medusa/interfaces/medusa.RequestQueryFields.mdx)
- [SubscriberContext](../medusa/interfaces/medusa.SubscriberContext.mdx)
@@ -538,6 +550,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [GetUploadedFileType](../medusa/types/medusa.GetUploadedFileType.mdx)
- [GiftCardAllocation](../medusa/types/medusa.GiftCardAllocation.mdx)
- [HttpCompressionOptions](../medusa/types/medusa.HttpCompressionOptions.mdx)
- [InnerSelector](../medusa/types/medusa.InnerSelector.mdx)
- [InternalModuleDeclaration](../medusa/types/medusa.InternalModuleDeclaration.mdx)
- [InventoryItemDTO](../medusa/types/medusa.InventoryItemDTO.mdx)
- [InventoryLevelDTO](../medusa/types/medusa.InventoryLevelDTO.mdx)
@@ -567,8 +580,6 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
- [PartialPick](../medusa/types/medusa.PartialPick.mdx)
- [PaymentContext](../medusa/types/medusa.PaymentContext.mdx)
- [PaymentData](../medusa/types/medusa.PaymentData.mdx)
- [PaymentProcessorContext](../medusa/types/medusa.PaymentProcessorContext.mdx)
- [PaymentProcessorSessionResponse](../medusa/types/medusa.PaymentProcessorSessionResponse.mdx)
- [PaymentSessionData](../medusa/types/medusa.PaymentSessionData.mdx)
- [PaymentSessionResponse](../medusa/types/medusa.PaymentSessionResponse.mdx)
- [PriceListLoadConfig](../medusa/types/medusa.PriceListLoadConfig.mdx)
@@ -1039,62 +1050,6 @@ ___
}
]
},
{
"name": "price_list_rules.price_list_rule_values",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_list_rules.price_list_rule_values.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules.rule_type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_list_rules.rule_type.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "`object`",
@@ -1122,6 +1077,34 @@ ___
}
]
},
{
"name": "price_rules",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set",
"type": "`object`",
@@ -1142,120 +1125,6 @@ ___
]
}
]
},
{
"name": "price_set_money_amounts.money_amount",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set_money_amounts.money_amount.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amounts.price_set",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "variant_link",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "variant",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "price_set_money_amounts.price_set.variant_link",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "variant",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "defaultAdminProductRemoteQueryObject.variants.fields",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "price_set_money_amounts.price_set.variant_link.variant",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "defaultAdminProductRemoteQueryObject.variants.fields",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set_money_amounts.price_set.variant_link.variant.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "defaultAdminProductRemoteQueryObject.variants.fields",
"expandable": false,
"children": []
}
]} />
@@ -1307,15 +1176,6 @@ This is temporary.
}
]
},
{
"name": "categories.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "collection",
"type": "`object`",
@@ -1335,15 +1195,6 @@ This is temporary.
}
]
},
{
"name": "collection.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "keyof [Product](../entities/classes/entities.Product.mdx)[]",
@@ -1372,15 +1223,6 @@ This is temporary.
}
]
},
{
"name": "images.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`object`",
@@ -1419,43 +1261,6 @@ This is temporary.
}
]
},
{
"name": "options.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options.values",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "options.values.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "profile",
"type": "`object`",
@@ -1476,13 +1281,23 @@ This is temporary.
]
},
{
"name": "profile.fields",
"type": "`string`[]",
"name": "sales_channels",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "tags",
@@ -1503,15 +1318,6 @@ This is temporary.
}
]
},
{
"name": "tags.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "`object`",
@@ -1531,15 +1337,6 @@ This is temporary.
}
]
},
{
"name": "type.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "`object`",
@@ -1577,43 +1374,6 @@ This is temporary.
]
}
]
},
{
"name": "variants.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants.options",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "variants.options.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1922,15 +1682,6 @@ This is temporary.
}
]
},
{
"name": "collection.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "keyof [Product](../entities/classes/entities.Product.mdx)[]",
@@ -1959,15 +1710,6 @@ This is temporary.
}
]
},
{
"name": "images.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`object`",
@@ -2006,43 +1748,6 @@ This is temporary.
}
]
},
{
"name": "options.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options.values",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "options.values.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "profile",
"type": "`object`",
@@ -2063,13 +1768,23 @@ This is temporary.
]
},
{
"name": "profile.fields",
"type": "`string`[]",
"name": "sales_channels",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "tags",
@@ -2090,15 +1805,6 @@ This is temporary.
}
]
},
{
"name": "tags.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "`object`",
@@ -2118,15 +1824,6 @@ This is temporary.
}
]
},
{
"name": "type.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "`object`",
@@ -2164,43 +1861,6 @@ This is temporary.
]
}
]
},
{
"name": "variants.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants.options",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "variants.options.fields",
"type": "`string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -2242,6 +1902,18 @@ ___
___
### defaultStoreRegionFields
`Const` **defaultStoreRegionFields**: `string`[]
___
### defaultStoreRegionRelations
`Const` **defaultStoreRegionRelations**: `string`[]
___
### defaultStoreReturnReasonFields
`Const` **defaultStoreReturnReasonFields**: keyof [ReturnReason](../entities/classes/entities.ReturnReason.mdx)[]
@@ -7940,7 +7612,7 @@ Generate a composed id based on the input parameters and return either the is if
"name": "idProperty",
"type": "`string`",
"description": "",
"optional": false,
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
@@ -7972,66 +7644,6 @@ Generate a composed id based on the input parameters and return either the is if
___
### getProductWithIsolatedProductModule
#### Parameters
<ParameterTypes parameters={[
{
"name": "req",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "retrieveConfig",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;any&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "any",
"type": "`any`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### getRequestedBatchJob
#### Parameters
@@ -8092,6 +7704,86 @@ ___
___
### getVariantsFromPriceList
#### Parameters
<ParameterTypes parameters={[
{
"name": "container",
"type": "[MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "createScope",
"type": "() => [MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "registerAdd",
"type": "`<T>`(`name`: `string`, `registration`: `T`) => [MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "priceListId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[ProductVariantDTO](../medusa/interfaces/medusa.ProductVariantDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ProductVariantDTO[]",
"type": "[ProductVariantDTO](../medusa/interfaces/medusa.ProductVariantDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ProductVariantDTO",
"type": "`object`",
"description": "A product variant's data.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
___
### hasChanges
Compare two objects and return true if there is changes detected from obj2 compared to obj1
@@ -8548,19 +8240,38 @@ ___
___
### listAndCountProductWithIsolatedProductModule
### listProducts
#### Parameters
<ParameterTypes parameters={[
{
"name": "req",
"type": "`any`",
"name": "container",
"type": "[MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
"children": [
{
"name": "createScope",
"type": "() => [MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "registerAdd",
"type": "`<T>`(`name`: `string`, `registration`: `T`) => [MedusaContainer](../medusa/types/medusa.MedusaContainer-1.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "filterableFields",
@@ -14277,6 +13988,66 @@ ___
___
### retrieveProduct
#### Parameters
<ParameterTypes parameters={[
{
"name": "container",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "remoteQueryObject",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;any&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "any",
"type": "`any`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### setMetadata
Dedicated method to set metadata.
@@ -0,0 +1,84 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# payment
## Classes
- [AbstractPaymentProcessor](../payment/classes/payment.AbstractPaymentProcessor.mdx)
## Interfaces
- [PaymentProcessor](../payment/interfaces/payment.PaymentProcessor.mdx)
- [PaymentProcessorContext](../payment/interfaces/payment.PaymentProcessorContext.mdx)
- [PaymentProcessorError](../payment/interfaces/payment.PaymentProcessorError.mdx)
- [PaymentProcessorSessionResponse](../payment/interfaces/payment.PaymentProcessorSessionResponse.mdx)
___
## Functions
### isPaymentProcessor
Return if the input object is AbstractPaymentProcessor
#### Parameters
<ParameterTypes parameters={[
{
"name": "obj",
"type": "`unknown`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "boolean",
"type": "`boolean`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### isPaymentProcessorError
Utility function to determine if an object is a processor error
#### Parameters
<ParameterTypes parameters={[
{
"name": "obj",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "obj",
"type": "obj is PaymentProcessorError",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,231 @@
---
displayed_sidebar: modules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorContext
A payment's context.
## Properties
<ParameterTypes parameters={[
{
"name": "amount",
"type": "`number`",
"description": "The payment's amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "billing_address",
"type": "`null` \\| [Address](../../entities/classes/entities.Address.mdx)",
"description": "The payment's billing address.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "`Record<string, unknown>`",
"description": "The cart's context.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The selected currency code, typically associated with the customer's cart.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customer",
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
"description": "The customer associated with this payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "billing_address",
"type": "[Address](../../entities/classes/entities.Address.mdx)",
"description": "The details of the billing address associated with the customer.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "billing_address_id",
"type": "`null` \\| `string`",
"description": "The customer's billing address ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "email",
"type": "`string`",
"description": "The customer's email",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "first_name",
"type": "`string`",
"description": "The customer's first name",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "groups",
"type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
"description": "The customer groups the customer belongs to.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "has_account",
"type": "`boolean`",
"description": "Whether the customer has an account or not",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The customer's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "last_name",
"type": "`string`",
"description": "The customer's last name",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "orders",
"type": "[Order](../../entities/classes/entities.Order.mdx)[]",
"description": "The details of the orders this customer placed.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "password_hash",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string`",
"description": "The customer's phone number",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "shipping_addresses",
"type": "[Address](../../entities/classes/entities.Address.mdx)[]",
"description": "The details of the shipping addresses associated with the customer.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "email",
"type": "`string`",
"description": "The customer's email.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "paymentSessionData",
"type": "`Record<string, unknown>`",
"description": "If the payment session hasn't been created or initiated yet, it'll be an empty object.\nIf the payment session exists, it'll be the value of the payment session's `data` field.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "resource_id",
"type": "`string`",
"description": "The ID of the resource the payment is associated with. For example, the cart's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -0,0 +1,41 @@
---
displayed_sidebar: modules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorError
An object that is returned in case of an error.
## Properties
<ParameterTypes parameters={[
{
"name": "code",
"type": "`string`",
"description": "The error code.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "detail",
"type": "`any`",
"description": "Any additional helpful details.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "error",
"type": "`string`",
"description": "The error message",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,20 +1,20 @@
---
displayed_sidebar: homepage
displayed_sidebar: modules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# PaymentProcessorSessionResponse
**PaymentProcessorSessionResponse**: `Object`
The response of operations on a payment.
## Type declaration
## Properties
<ParameterTypes parameters={[
{
"name": "session_data",
"type": "`Record<string, unknown>`",
"description": "",
"description": "The data to be stored in the `data` field of the Payment Session to be created.\nThe `data` field is useful to hold any data required by the third-party provider to process the payment or retrieve its details at a later point.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -23,7 +23,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "update_requests",
"type": "`object`",
"description": "",
"description": "Used to specify data that should be updated in the Medusa backend.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -31,7 +31,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "customer_metadata",
"type": "`Record<string, unknown>`",
"description": "",
"description": "Specifies a new value of the `metadata` field of the customer associated with the payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -42,7 +42,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
{
"name": "update_requests.customer_metadata",
"type": "`Record<string, unknown>`",
"description": "",
"description": "Specifies a new value of the `metadata` field of the customer associated with the payment.",
"optional": true,
"defaultValue": "",
"expandable": false,
+1 -1
View File
@@ -730,7 +730,7 @@ module.exports = {
},
{
type: "doc",
id: "modules/carts-and-checkout/backend/add-payment-provider",
id: "references/payment/classes/payment.AbstractPaymentProcessor",
label: "Backend: Create Payment Processor",
},
{
@@ -15,6 +15,7 @@ import {
TriangleRightMini,
} from "@medusajs/icons"
import IconFlagMini from "../../../theme/Icon/FlagMini"
import decodeStr from "../../../utils/decode-str"
type ParameterTypesItemsProps = {
parameters: Parameter[]
@@ -127,7 +128,7 @@ const ParameterTypesItems = ({
/>
)}
<div className="flex gap-0.75 flex-wrap">
<InlineCode>{parameter.name}</InlineCode>
<InlineCode>{decodeStr(parameter.name)}</InlineCode>
<span className="font-monospace text-compact-small-plus text-medusa-fg-subtle">
<MarkdownContent allowedElements={["a"]} unwrapDisallowed={true}>
{parameter.type}
+8
View File
@@ -0,0 +1,8 @@
export default function decodeStr(str: string) {
return str
.replaceAll("&#60;", "<")
.replaceAll("&#123;", "{")
.replaceAll("&#125;", "}")
.replaceAll("&#62;", ">")
.replaceAll("\\|", "|")
}