# ShopPayButton The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout. It renders a [``](https://shopify.dev/custom-storefronts/tools/web-components) custom element, for which it will lazy-load the source code automatically. ```jsx import {ShopPayButton} from '@shopify/hydrogen-react'; export function AddVariantQuantity1({variantId, storeDomain}) { return ; } export function AddVariantQuantityMultiple({variantId, quantity, storeDomain}) { return ( ); } export function ChannelAttribution({channel, variantId, storeDomain}) { return ( ); } ``` ```tsx import {ShopPayButton} from '@shopify/hydrogen-react'; export function AddVariantQuantity1({ variantId, storeDomain, }: { variantId: string; storeDomain: string; }) { return ; } export function AddVariantQuantityMultiple({ variantId, quantity, storeDomain, }: { variantId: string; quantity: number; storeDomain: string; }) { return ( ); } export function ChannelAttribution({ channel, variantId, storeDomain, }: { channel: 'headless' | 'hydrogen'; variantId: string; storeDomain: string; }) { return ( ); } ``` ## Props ### ShopPayButtonStyleProps ### className value: `string` A string of classes to apply to the `div` that wraps the Shop Pay button. ### width value: `string` A string that's applied to the [CSS custom property (variable)](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) `--shop-pay-button-width` for the [Buy with Shop Pay component](https://shopify.dev/custom-storefronts/tools/web-components#buy-with-shop-pay-component). ### ShopPayDomainProps ### storeDomain value: `string` The domain of your Shopify storefront URL (eg: `your-store.myshopify.com`). ### ShopPayChannelAttribution ### channel value: `'headless' | 'hydrogen'` A string that adds channel attribution to the order. Can be either `headless` or `hydrogen` ### ShopPayVariantIds ### variantIds value: `string[]` An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use `variantIdsAndQuantities`. ### variantIdsAndQuantities value: `never` An array of variant IDs and quantities to purchase with Shop Pay. ### ShopPayVariantAndQuantities ### variantIds value: `never` An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use `variantIdsAndQuantities`. ### variantIdsAndQuantities value: `Array<{ id: string; quantity: number; }>` An array of variant IDs and quantities to purchase with Shop Pay. ## Examples The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout. It renders a [``](https://shopify.dev/custom-storefronts/tools/web-components) custom element, for which it will lazy-load the source code automatically. If `` context provider is used in your app, you can use the `` without supplying a `storeDomain` prop ```jsx import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; export default function App() { return ( ); } export function AddVariantQuantity1({variantId}) { return ; } ``` ```tsx import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; export default function App() { return ( ); } export function AddVariantQuantity1({variantId}: {variantId: string}) { return ; } ``` ## Examples The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout. It renders a [``](https://shopify.dev/custom-storefronts/tools/web-components) custom element, for which it will lazy-load the source code automatically. If `` context provider is used in your app, you can use the `` without supplying a `storeDomain` prop ```jsx import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; export default function App() { return ( ); } export function AddVariantQuantity1({variantId}) { return ; } ``` ```tsx import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; export default function App() { return ( ); } export function AddVariantQuantity1({variantId}: {variantId: string}) { return ; } ```