docs: improve commerce modules [3/n] (#9510)

Improve and add docs for Order and Payment modules

[3/n]

Closes DOCS-966
Closes #9485
This commit is contained in:
Shahed Nasser
2024-10-14 07:20:35 +00:00
committed by GitHub
parent 74b286b701
commit 11120a8b7e
30 changed files with 662 additions and 314 deletions
@@ -8,15 +8,17 @@ In this document, youll learn how the Payment Module supports listening to we
## What's a Webhook Event?
A webhook event is sent from a third-party payment provider to your application. It indicates a change in a payments status. This is useful in different cases such as when a payment is being processed asynchronously or when a request is interrupted.
A webhook event is sent from a third-party payment provider to your application. It indicates a change in a payments status.
This is useful in many cases such as when a payment is being processed asynchronously or when a request is interrupted and the payment provider is sending details on the process later.
---
## processEvent Method
The Payment Modules main service (`IPaymentModuleService`) provides a [processEvent method](/references/payment/processEvent) used to handle incoming webhook events from third-party payment services. The method delegates the handling to the associated payment provider, which returns the event's details.
The Payment Modules main service has a [processEvent method](/references/payment/processEvent) used to handle incoming webhook events from third-party payment services. The method delegates the handling to the associated payment provider, which returns the event's details.
Medusa implements a webhook listener at the `/hooks/payment/[provider]` API route, where `[provider]` is the ID of the provider (for example, `stripe`). You can use that webhook listener in your third-party payment provider's configurations.
Medusa implements a webhook listener route at the `/hooks/payment/[provider]` API route, where `[provider]` is the ID of the provider (for example, `stripe`). Use that webhook listener in your third-party payment provider's configurations.
![A diagram showcasing the steps of how the processEvent method words](https://res.cloudinary.com/dza7lstvk/image/upload/v1711567415/Medusa%20Resources/payment-webhook_seaocg.jpg)