--- title: "Payment Confirmation Dialog" description: "Drop in Autumn's Confirm Payment Dialog component to let your customers confirm their payment" --- A users first payment will happen via a Stripe hosted Checkout URL. After that, you can configure the Payment Confirmation dialog to open when a customer wants to make another payment (eg upgrades, downgrades, topups). This component allows you to let your customers preview how much will be charged, and confirm the change. Product Change Dialog You can use the component as is, or download the shadcn/ui component and edit it to your needs. **React** ```jsx import { CheckoutDialog } from "autumn-js/react"; ``` **shadcn/ui** ```bash npm npx shadcn@latest add https://ui.useautumn.com/checkout-dialog ``` ```bash pnpm pnpm dlx shadcn@latest add https://ui.useautumn.com/checkout-dialog ``` ```bash yarn yarn dlx shadcn@latest add https://ui.useautumn.com/checkout-dialog ``` ```bash bun bunx --bun shadcn@latest add https://ui.useautumn.com/checkout-dialog ``` This will download the checkout-dialog component in your `/components` directory, under a `/autumn` folder. #### Usage Pass in the `checkout-dialog` component to the `checkout()` hook. This allows Autumn to automatically open the checkout dialog when they want to change their active product. The dialog will open if: - The customer needs to input a quantity for their purchase (ie, if the product has prepaid prices) - If the customer's payment method is already on file (ie, for upgrades, downgrades or add-ons). When the customer confirms the purchase, Autumn will attach the product to the customer. If there are no inputs required and it's a new customer (without an existing payment method), the customer will be redirected straight to the Stripe checkout page. ```jsx import CheckoutDialog from "@/components/autumn/checkout-dialog"; // or import { CheckoutDialog } from "autumn-js/react"; import { useCustomer } from "autumn-js/react"; const { checkout } = useCustomer(); ); } ``` If `preview` is returned, it will contain a `scenario` enum. You can use this to control the messaging you display to the user. See our shadcn/ui dialog messaging for an example. | Scenario | Description | | ----------- | --------------------------------------------------------------------------------------------------------- | | `upgrade` | The customer is upgrading their product | | `downgrade` | The customer is downgrading to another paid tier | | `cancel` | The customer is downgrading to a free product | | `renew` | The customer is reactivating a product that was previously cancelled | | `scheduled` | The product is already scheduled to start at a future date (eg, for downgrades), so no changes are needed | | `active` | The customer already has the product active, so no changes are needed |