Attributes

Table of contents

  1. embed-token
  2. usd
  3. btc
  4. data
  5. ref
  6. redirect-url

This section outlines all required and optional HTML attributes that configure the behavior of the Pay With Bitcoin button. These attributes allow you to tailor how the widget interacts with customers during their payment experience.

<div 
  class="posfra-pay-button"
  embed-token="f419128f528d75174399b3662a2e0ceaed29b98a59cbc9d33601fa2f903c1b6f"
  usd="50"
  redirect-url="https://yoursite.com/paid"
  ref="order-12345"
  data='{"customerId":"abc123"}'
></div>

embed-token

The embed-token attribute is a required configuration parameter for initializing the Pay With Bitcoin button using the Posfra.js SDK. This unique token securely links the payment widget to your account and enables it to process transactions on your behalf.

  • Required: Yes
  • Type: string (unique identifier)

usd

The amount in USD to charge the user in the payment widget.

  • Required: Yes (or btc attribute)
  • Type: float(2) (Greater than $20.00)

btc

The amount in BTC to charge the user in the payment widget.

  • Required: Yes (or usd attribute)
  • Type: float(8) (Greater than 0.0002)

data

Arbitrary user data. This can be any string value up to 500 chars. This can be used as a way to send a message or a way to store JSON data to be stored along with the Transaction.

  • Required: No
  • Type: string(500)

ref

An optional user defined ‘reference’ to the transaction. If this is not set, a ref will be generated and will be set to the ref attribute. You can get the status of the transaction using the ref.

This feature was designed for users with serverless SPA. You can use the ref to get transaction information using the Posfra REST API, like the status, Bitcoin txid and Posfra Transasction ID.

If you set the ref, you should not use the same ref multiple times. The API does not harshly validate refs so there will not be any obvious errors if you submit a request with an already used ref. But you will only get the latest transaction when you use the API to getTransactionByRef().

  • Required: No
  • Type: string(12)

redirect-url

Redirect the user to a pre-defined webpage when the transaction is Accepted.

  • Required: No
  • Type: string(255) (Valid URL)

No AI was used in the creation of this documentation.