Documentation

How to start accepting Bitcoin payments with just 2 lines of code!

Docs
5 Min Read
24
9
Avatar
Author
Posfra Team

To add a Posfra Payment Widget to your website simply add the following code to your website.

The script tag loads the JavaScript plugin from our CDN. This line can optionally be placed in your <head> tag if you prefer. The script will look for any div with the class posfra.

<script src="https://cdn.posfra.com/embed.js"></script>

<div
  class="posfra"
  data-embed-token="99a2ef448e590a910c70daf398c959f9f5cef7569ba41274c619edf9e9433942"
  data-allow-custom
  data-btc="0.002"
  data-meta="string:255"
  data-redirect-url="http://example.com/complete"
  data-no-warnings
></div>

Attributes

In this section we will discuss all of the required an optional attributes for the Posfra widget. This section outlines all required and optional HTML attributes that configure the behavior of the Posfra widget. These attributes allow you to tailor how the widget interacts with customers during their payment experience.

data-embed-token

  • Description: A unique embed token required for the widget to function.
  • Type: string
  • Required: ✅ Yes

All Posfra widgets must include a valid embed token. This token links the widget to your account and enables transaction processing.

data-allow-custom

  • Description: Allows the customer to enter a custom amount for payment.
  • Type: boolean (present or not)
  • Default: false

Use this if you want to let users specify their own payment amount.

data-btc

  • Description: Specifies a fixed BTC amount the customer must send.
  • Type: float

Use this to enforce a specific payment amount in Bitcoin.

data-meta

  • Description: A custom string that will be stored with the transaction and included in webhooks.
  • Type: string
  • Max Length: 255 characters

Use this for passing metadata such as order IDs, user references, or notes.

data-redirect-url

  • Description: URL to redirect the customer after a successful transaction.
  • Type: string (URL)

After the transaction is received and confirmed, the user will be redirected to the URL specified here.

data-no-warnings

  • Description: Disables the warning shown if a customer tries to leave the page before completing the transaction.
  • Type: boolean (present or not)

Use this attribute to suppress navigation warnings for unfinished transactions.


Related Tags:
Share this post: