Bias Checkout

Send customers to Bias Checkout, a payment page that Bias hosts, instead of building a checkout form yourself.

Every checkout session has a url that opens it in Checkout. Checkout shows what the customer is buying, collects their contact details and payment method, and takes the payment. Create a session on your server and redirect the customer to its url. To put the payment form inside your own page instead, use Checkout elements. To sell with a reusable link and no code, use checkout links.

Checkout with the merchant's logo and colors

Create a session and redirect

List what the customer is buying in line_items. Each line has a price from your catalog, or price_data with an amount in cents for either a catalog product or a one-off name. A product line shows the product’s name and images in Checkout, and product discounts apply to it.

server.ts

const session = await bias.checkoutSessions.create({
    line_items: [
        { price: "price_...", quantity: 2 },
        { price_data: { product: "prod_...", unit_amount: 4500 }, quantity: 1 },
        { price_data: { name: "Gift wrapping", unit_amount: 500 }, quantity: 1 },
    ],
    success_url: "https://example.com/orders/complete",
});

if (session.object === "error") throw new Error(session.error.message);

return Response.redirect(session.url, 303);

Checkout offers the payment methods turned on under Payment methods in Settings → Checkout. Pass payment_method_types to limit a session to some of them.

Modes

A session’s mode sets what completing it does:

  • payment (the default) collects a one-time payment for its line_items, or for an invoice. It needs one of the two.
  • subscription starts a subscription for its recurring line items, which must all bill on the same interval. One-time prices in the cart are charged with the first payment. It can’t be used with an invoice. To start with a free trial, see free trials at checkout.
  • setup saves a payment method without charging it, and can’t have line items. Pass subscription to replace a subscription’s payment method, such as after a failed renewal. When the session completes, invoices waiting on payment are charged to the new payment method.

If a paid subscription session’s subscription can’t be started within two hours, the payment is refunded and the session expires.

After the customer pays

When the session’s payments succeed, the session completes and Checkout redirects the customer to your success_url. Without a success_url, the customer stays on Checkout and sees a confirmation of their order.

The redirect is only a confirmation for the customer. Fulfill the order when your server receives checkout_session.completed from the event stream. A bank payment completes the session when the debit succeeds, not when the customer submits it.

To stop a session from being paid, expire it.

Branding

Checkout uses the colors, icon and logo in Settings → Branding. The same branding appears on your invoices and customer emails.

Settings → Branding with a preview of the checkout page
  • Accent color: buttons and links.
  • Background color: the page background.
  • Icon: a square icon shown on payment pages and emails.
  • Logo: a full size logo or wordmark shown on Checkout and invoice PDFs.

The preview next to the form shows your changes before you click Save.

To show links to your store and policies on Checkout, add them under Store links in Settings → Checkout: Return to cart, Refund policy, Shipping policy, Privacy policy and Terms of service.

Use your own domain

By default, Checkout is served from checkout.biaspay.com. To serve it from a domain of yours, such as checkout.example.com:

  1. In Settings → Checkout, click Add custom domain in the Custom domain card.
  2. Enter the Domain and click Add domain.
  3. Add the DNS records the card lists at your DNS provider. If Bias recognizes your provider, the card links to its settings.
  4. Click I’ve updated DNS records.
The Custom domain card in Settings → Checkout

Bias checks the records, then sets up an HTTPS certificate. This usually takes a few minutes. When the card shows Connected, your checkout links use your domain, and so do checkout sessions and invoice payment links created from then on. If the domain isn’t connected by the date shown under the records, Bias removes it.

The TXT record only proves you own the domain. You can delete it once the domain is connected.

To stop using the domain, choose Remove domain from the card’s menu. Checkout moves back to checkout.biaspay.com right away. Links you already shared on your domain keep working until you delete its CNAME record.