Embed snippet

Drop one <script> tag on any page and turn any button into a PAID checkout trigger. No framework required.

Install

Add the script to the bottom of <body> on any page where you want PAID checkout:

<script async src="https://paid.trustfabric.ai/v1/embed.js"></script>

Declarative usage

Attach data-paid-checkout to any element and PAID will turn it into a checkout trigger. The element's attributes describe the charge.

index.html
<button data-paid-checkout
  data-account="acct_yourmerchantid"
  data-amount="4999"
  data-currency="usd"
  data-sku="pro-plan">
  Pay $49.99
</button>

<script async src="https://paid.trustfabric.ai/v1/embed.js"></script>

Supported attributes

AttributeTypeRequiredDescription
data-paid-checkoutflagyesMarks the element as a PAID checkout trigger.
data-accountstringyesYour merchant account ID (find it in Dashboard → API Key).
data-amountinteger (cents)yesCharge amount, in the smallest unit of the currency.
data-currencyISO 4217yesCurrency code, e.g. usd.
data-skustringnoYour product SKU, returned on the webhook.
data-customer-emailemailnoPre-fill on the checkout page.
data-success-urlURLnoRedirect on success. Defaults to current page with ?paid=ok.
data-moderedirect | modalnoDefault is modal.

Programmatic usage

For dynamic prices or A/B experiments, call paid.checkout() directly:

open-checkout.js
// Programmatically open PAID checkout.
// Load the embed script first — it attaches window.Paid (it is not
// an ES module and there is no npm package):
//   <script async src="https://paid.trustfabric.ai/v1/embed.js"></script>

const paid = window.Paid("acct_yourmerchantid");

document.getElementById("buy").addEventListener("click", async () => {
  await paid.checkout({
    amount: 4999,
    currency: "usd",
    sku: "pro-plan",
    onSuccess: (result) => console.log("paid", result),
    onCancel: () => console.log("cancelled"),
  });
});

Configuration via the account ID

The data-account value is a public identifier for your merchant account. It can only create sessions on your account, and cannot read or modify any other data. Find it in Dashboard → API Key, in the account summary card.

Never put a sk_live_… secret key in browser code. Use data-account for the embed, and authenticate with the secret key only from your server.