---
title: Your first Buy button
description: Publish your ebook, activate selling, and put its buy link on your own website.
order: 10
published: 2026-10-02
updated: 2026-10-02
---
## 1. Get your book ready to sell

[Create your author account](/sign-up?next=%2Fdashboard&intent=author). Accept the terms, add your book and connect Stripe for identity and bank details. Activate selling and publish the book. Listed is $5/month; [Sender](/pricing) is $20/month. Setup is free during the 7-day trial, but nothing sells until a plan is active.

You keep 90% of the sale price after discounts, before tax. The Book Market takes a 10% platform fee and handles sales tax as merchant of record. Payouts go through Stripe Connect.

## 2. Copy the buy link

Your book's buy link has this shape:

```text
https://thebookmarket.com/checkout/<author>/<book>
```

Use the actual author and book slugs. If you are using the [catalog API](/developers/api), copy its `buy_url`; don't guess a URL for a book that isn't on sale.

## 3. Paste a button

Replace the uppercase placeholders before publishing this HTML:

```html
<a href="https://thebookmarket.com/checkout/YOUR-AUTHOR-SLUG/YOUR-BOOK-SLUG">
  Buy my ebook
</a>
```

Readers don't need a Book Market account to buy: checkout supports guests. The link opens checkout as a page; no embedded checkout or script is needed.

## Render a book from the API

Replace the two slug values. This example uses text nodes for book data, so a title or description is never interpreted as HTML. It leaves the button hidden when the book is unavailable or the request fails.

```html
<article id="book-card">
  <h2 id="book-title">My ebook</h2>
  <p id="book-description"></p>
  <p id="book-status" role="status">Loading book…</p>
  <a id="book-buy" hidden>Buy ebook</a>
</article>
<script type="module">
  const author = 'YOUR-AUTHOR-SLUG';
  const slug = 'YOUR-BOOK-SLUG';
  const status = document.getElementById('book-status');
  try {
    const response = await fetch(
      `https://thebookmarket.com/api/v1/books/${encodeURIComponent(author)}/${encodeURIComponent(slug)}`
    );
    if (!response.ok) throw new Error('Book unavailable');
    const book = await response.json();
    document.getElementById('book-title').textContent = book.title;
    document.getElementById('book-description').textContent = book.description ?? '';
    const buy = document.getElementById('book-buy');
    if (book.availability === 'on_sale' && book.buy_url) {
      buy.href = book.buy_url;
      buy.textContent = `Buy ebook — ${book.price.display}`;
      buy.hidden = false;
      status.textContent = '';
    } else {
      status.textContent = 'This book is currently unavailable.';
    }
  } catch {
    status.textContent = 'Book details are unavailable. Please try again later.';
  }
</script>
```

## Check your page

Use a real published book. Follow the button to verify that checkout shows the right title and price. An unavailable book has `buy_url: null`; hide its Buy button. For errors and retry behavior, see [API errors](/developers/api#errors).

Choose [Next.js](/developers/nextjs), [Astro](/developers/astro), or a [plain HTML page](/developers/html) for a framework-specific starting point.
