Adding a payment button on your website is a quick and easy way to start accepting cryptocurrency payments, whether it’s to accept donations for an open source project or to sell tickets to your event.
Before adding a payment button, you need to whitelist your (https) website.
- Go to Settings > Security
- Click on Whitelist a domain.
- Add your website domain and click Save.
Currently, we only allow https domains.
- Click on the Accept payments button within the dashboard.
- Choose between one of two payment types.
- Go through the flow until you reach a hosted page.
- Copy the code snippet to embed a payment button on your website.
Expand for images of the user authentication flow
A best practice is to test before deploying. Here’s a quick way to test your payment button before pushing it to the world.
This section requires some beginner level programming knowledge.
Whitelist localhost or, if you’re using a service like ngrok, the forwarding URL. For example:
Create a simple HTML file with the button code embedded so you can serve the file locally. At the command line create an empty folder along with an empty
$ mkdir payment-button && cd payment-button && touch index.html
- Add the payment button code snippet to your
index.htmlfile using your preferred editor. The contents of your file should look something like this:
<div> <a class="donate-with-crypto" href="https://commerce.coinbase.com/checkout/6da189f179bc31"> <span>Donate with Crypto</span> </a> <script src="https://commerce.coinbase.com/v1/checkout.js"> </script> </div>
- From within the
payment-buttondirectory, run python’s SimpleHTTPServer (this assumes you already have python installed):
$ python -m SimpleHTTPServer
- Navigate to http://localhost:8000 in your browser. You should see your payment button rendered in the browser.
Congratulations! You can now start accepting cryptocurrency on the web.
Updated 20 days ago