1 export const metadata = {
2 title: `Payment Steps in Checkout Flow`,
3 }
4
5 # {metadata.title}
6
7 In this guide, you'll learn about Medusa's accept payment flow that's used in checkout.
8
9 ## Overview of the Payment Flow in Checkout
10
11 The Medusa application has a built-in payment flow that allows you to accept payments from customers, typically during checkout.
12
13 This flow is designed to be flexible and extensible, allowing you to integrate with various payment providers.
14
15 The payment flow consists of the following steps:
16
17 ![A diagram showcasing the payment flow's steps](https://res.cloudinary.com/dza7lstvk/image/upload/v1711566781/Medusa%20Resources/payment-flow_jblrvw.jpg)
18
19 - [Create Payment Collection](!api!/store/payment-collections/create-payment-collection): Create a payment collection associated with a cart.
20 - This payment collection will hold all details related to the payment operations.
21 - [Show Payment Providers](!api!/store/payment-providers/list-payment-providers): Show the customer the available payment providers to choose from.
22 - You can integrate any [payment provider](../payment-provider/page.mdx), and you can enable them per region.
23 - [Create and Initialize Payment Session](!api!/store/payment-collections/initialize-payment-session): Create a payment session for the selected payment provider in the Medusa application, and initialize the session in the third-party payment provider. Medusa validates that the chosen provider is enabled in the cart's region and throws an error if it is not.
24 - [Complete Cart](!api!/store/carts/complete-cart): Once the customer places the order, complete the cart, which involves:
25 - Authorizing the payment session with the third-party payment provider.
26 - If the third-party payment provider requires performing additional actions, show them to the customer, then retry cart completion.
27
28 ---
29
30 ## Implement Payment Checkout Step in Storefront
31
32 If you're using the [Next.js Starter Storefront](../../../nextjs-starter/page.mdx), the checkout flow is already implemented with the payment step.
33
34 If you're building a custom storefront, or you want to customize the checkout flow, you can follow the [Checkout in Storefront](../../../storefront-development/checkout/page.mdx) guide to learn how to build the checkout flow in the storefront, including the payment step.
35
36 ---
37
38 {/* TODO add section on customizng the payment flow */}
39
40 ## Build a Custom Payment Flow
41
42 You can also build a custom payment flow using workflows or the Payment Module's main service.
43
44 Refer to the [Accept Payment Flow](../payment-flow/page.mdx) guide to learn more.