Payment Steps in Checkout Flow

In this guide, you'll learn about Medusa's accept payment flow that's used in checkout.

Overview of the Payment Flow in Checkout#

The Medusa application has a built-in payment flow that allows you to accept payments from customers, typically during checkout.

This flow is designed to be flexible and extensible, allowing you to integrate with various payment providers.

The payment flow consists of the following steps:

A diagram showcasing the payment flow's steps

  • Create Payment Collection: Create a payment collection associated with a cart.
    • This payment collection will hold all details related to the payment operations.
  • Show Payment Providers: Show the customer the available payment providers to choose from.
  • Create and 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.
  • Complete Cart: Once the customer places the order, complete the cart, which involves:
    • Authorizing the payment session with the third-party payment provider.
    • If the third-party payment provider requires performing additional actions, show them to the customer, then retry cart completion.

Implement Payment Checkout Step in Storefront#

If you're using the Next.js Starter Storefront, the checkout flow is already implemented with the payment step.

If you're building a custom storefront, or you want to customize the checkout flow, you can follow the Checkout in Storefront guide to learn how to build the checkout flow in the storefront, including the payment step.


Build a Custom Payment Flow#

You can also build a custom payment flow using workflows or the Payment Module's main service.

Refer to the Accept Payment Flow guide to learn more.

Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break