docs: added idempotency key documentation (#4039)

This commit is contained in:
Shahed Nasser
2023-05-08 19:21:07 +03:00
committed by GitHub
parent e9ca647a1d
commit a8887cd02f
22 changed files with 290 additions and 64 deletions

View File

@@ -36,13 +36,9 @@ You can create a claim either using the [Create Claim endpoint](/api/admin#tag/O
### Idempotency Key
An Idempotency Key is a unique key associated with a claim. It is generated when the claim creation process is started by the admin using the Create Claim endpoint. The idempotency key is stored in the `ClaimOrder` entity in the attribute `idempotency_key`.
An Idempotency Key is a unique key associated with a claim. It is generated when the claim creation process is started by the admin using the [Create Claim endpoint](/api/admin#tag/Orders/operation/PostOrdersOrderClaims) and can be used to retry the claim creation safely if an error occurs. The idempotency key is stored in the `ClaimOrder` entity in the attribute `idempotency_key`.
That Idempotency Key is then set in the header under the `Idempotency-Key` response header field along with the header field `Access-Control-Expose-Headers` set to `Idempotency-Key`.
The backend wraps essential parts of the claim creation process in its own step and stores the current step (known as recovery point) of the process with its associated Idempotency Key.
Then, if the request is interrupted for any reason or an error occurs, the client can retry creating the return using the Idempotency Key, and the flow will continue from the last stored step.
You can learn more about idempotency keys [here](../../development/idempotency-key/overview.mdx).
### Create Claim Endpoint Process

View File

@@ -42,13 +42,9 @@ Returns can be created in three ways:
### Idempotency Key
An Idempotency Key is a unique key associated with a return. It is generated when the return creation process is started by the customer. The idempotency key is stored in the `Return` entity in the attribute `idempotency_key`.
An Idempotency Key is a unique key associated with a return. It is generated when the return creation process is started by the customer and can be used to retry the return creation safely if an error occurs. The idempotency key is stored in the `Return` entity in the attribute `idempotency_key`.
That Idempotency Key is then set in the header under the `Idempotency-Key` response header field along with the header field `Access-Control-Expose-Headers` set to `Idempotency-Key`.
The backend wraps essential parts of the return creation process in its own step and stores the current step (known as recovery point) of the process with its associated Idempotency Key.
Then, if the request is interrupted for any reason or an error occurs, the client can retry creating the return using the Idempotency Key, and the flow will continue from the last stored step.
You can learn more about idempotency keys [here](../../development/idempotency-key/overview.mdx).
### Return Creation Process Through the Customer

View File

@@ -39,16 +39,12 @@ In Medusa, Swaps are created by the customer through the storefront. This ensure
### Idempotency Key
An Idempotency Key is a unique key associated with a swap. It is generated when the swap creation process is started. The idempotency key is stored in the `Swap` entity under the attribute `idempotency_key`.
That Idempotency Key is then set in the header under the `Idempotency-Key` response header field along with the header field `Access-Control-Expose-Headers` set to `Idempotency-Key`.
The backend wraps essential parts of the swap creation process in its own step and stores the current step (known as recovery point) of the process with its associated Idempotency Key.
Then, if the request is interrupted for any reason or an error occurs, the client can retry creating the swap using the Idempotency Key, and the flow will continue from the last stored step.
An Idempotency Key is a unique key associated with a swap. It is generated when the swap creation process is started and can be used to retry the swap creation safely if an error occurs. The idempotency key is stored in the `Swap` entity under the attribute `idempotency_key`.
Keep in mind that the idempotency key stored in the swap is only used when creating the swap. All operations related to the swaps cart and its completion use the [carts idempotency key](../carts-and-checkout/cart.md#idempotency-key).
You can learn more about idempotency keys [here](../../development/idempotency-key/overview.mdx).
### Swap Creation Process
The customer starts by creating their swap, which can be done through the Create Swap endpoint. In this endpoint, the following steps are implemented: