Create an embeddable buy button to sell a product, subscription, or accept a payment on your website. Start by selecting an existing link from the Payment Links list view or by creating a new link where you can decide which products to sell and the payment experience. After you’ve created your link, click Buy button to configure the buy button design and generate the code that you can copy and paste into your website.
Customize the button
By default, your buy button uses the same branding and call to action configured for your payment link. You can:
- Choose between a simple button and a card widget.
- Set brand colors, shapes, and fonts to match your website.
- Set the language of the button and payment page to match your website’s language.
- Customize your button’s call to action.
Embed the button
Stripe provides an embed code composed of a
<script> tag and a
<stripe-buy-button> web component. Click Copy code to copy the code and paste it into your website.
If you’re using HTML, paste the embed code into the HTML. If you’re using React, include the
script tag in your
index.html page to mount the
The buy button uses your account’s publishable API key. If you revoke the API key, you need to update the embed code with your new publishable API key.
Attributes to customize checkout
Content Security Policy
If you’ve deployed a Content Security Policy, the policy directives that the buy button requires are:
- frame-src, https://js.stripe.com
- script-src, https://js.stripe.com
Rendering the buy button requires a website domain. To test the buy button locally, run a local HTTP server to host your website’s
index.html file over the localhost domain. To run a local HTTP server, use Python’s SimpleHTTPServer or the http-server npm module.
After your customer makes a payment using a payment link, you can see it in the payments overview in the Dashboard.
If you’re new to Stripe, you will receive an email after your first payment. To receive emails for all successful payments, update your notification preferences in your profile settings.
Read our full guide for more information on configuring the post-payment experience for a buy button or payment link.