www/apps/resources/app/commerce-modules/payment/payment-provider/page.mdx
import { CardList } from "docs-ui"
export const metadata = {
title: Payment Module Provider,
}
In this guide, you’ll learn about the Payment Module Provider and how it's used.
<Note title="Looking for no-code docs?">Refer to this Medusa Admin User Guide to learn how to manage the payment providers available in a region using the dashboard.
</Note>The Payment Module Provider handles payment processing in the Medusa application. It integrates third-party payment services, such as Stripe.
To authorize a payment amount with a payment provider, a payment session is created and associated with that payment provider. The payment provider is then used to handle the authorization.
After the payment session is authorized, the payment provider is associated with the resulting payment and handles its payment processing, such as to capture or refund payment.
<CardList items={[ { href: "/commerce-modules/payment/payment-provider/stripe", title: "Stripe" } ]} />
The Payment Module provides a system payment provider that acts as a placeholder payment provider.
It doesn’t handle payment processing and delegates that to the merchant. It acts similarly to a cash-on-delivery (COD) payment method.
<Note title="Tip">The identifier of the system payment provider is pp_system.
A payment provider is a module whose main service extends the AbstractPaymentProvider imported from @medusajs/framework/utils.
The module can have multiple payment provider services, where each is registered as a separate payment provider.
Refer to this guide on how to create a payment provider for the Payment Module.
After you create a payment provider, you can enable it as a payment provider in a region using the Medusa Admin dashboard.
The Payment Module accepts a providers option that allows you to configure the providers registered in your application.
Learn more about this option in the Module Options guide.
When the Medusa application starts, it registers the Payment Module Providers defined in the providers option of the Payment Module.
For each Payment Module Provider, the Medusa application finds all payment provider services defined in them to register.
A registered payment provider is represented by the PaymentProvider data model in the Medusa application.
This data model is used to reference a service in the Payment Module Provider and determine whether it's installed in the application.
The PaymentProvider data model has the following properties:
id: The unique identifier of the Payment Module Provider. The ID's format is pp_{identifier}_{id}, where:
identifier is the value of the identifier property in the Payment Module Provider's service.id is the value of the id property of the Payment Module Provider in medusa-config.ts.is_enabled: A boolean indicating whether the payment provider is enabled.If you remove a payment provider from the providers option, the Medusa application will not remove the associated PaymentProvider data model record.
Instead, the Medusa application will set the is_enabled property of the PaymentProvider's record to false. This allows you to re-enable the payment provider later if needed by adding it back to the providers option.