LogoLogo
  • Introduction
    • 🏁What is PIP?
  • Product Guide
    • 💧Social Pay
    • 🎭PIP.ME
    • 🔗Payment Links
    • 🛍️Checkout
      • Setting your Store
      • Dashboard (For Merchants)
      • Start Selling
      • Payments
      • Store Policy
    • 🔷Pay Button
      • HTML
      • React
      • Javascript
    • 📃Invoice
  • Tokenomics
    • 🅿️PIP Token
    • 🪙Reward Farming
    • ↔️PIP Token - ERC20 Bridge Guide
  • Additional Guides
    • ❔Frequently Asked Questions
    • 💸How to Install Wallets
    • ⬆️Update Your Extension
  • Announcements
    • 🔵PIP Version 2.1 - Base Network Integration
    • 🔴PIP Version 2.0 - Optimism Network & Worldcoin
    • ❤️PIP Version 1.9 - Avalanche Network & Coinbase Wallet
    • 📄New Product: PIP invoice
    • 🖤PIP Version 1.8 - Ethereum Integration
    • 💜PIP Version 1.7 - Polygon Integration
    • 🦊PIP Version 1.6 - MetaMask and Github Integration + New Listings
    • 🪙BAB Exclusive PIP Reward Event
    • 🔶PIP.ME 2.0 Now Live
    • 🦄PIP Version 1.5 - BNB Chain Integration
    • 4️⃣PIP Version 1.4 & NFT Support Now Live
    • 3️⃣PIP Version 1.3 & PIP.ME Now Live
    • 2️⃣PIP Version 1.2 & Discord Support
    • 1️⃣PIP Version 1.1 & Reward Farming. Now Live
    • 💎PIP Token & Extension App Launched
  • Resources
    • Getpip.com (Website)
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page
  1. Product Guide
  2. Pay Button

HTML

PreviousPay ButtonNextReact

Last updated 2 years ago

The easiest way to add Pay Button to a website is to use HTML.

Before defining the button, start by adding this code to the website in any place.

<script src="https://{https://button.getpip.com/cdn/pipbutton.js}"></script>

This script enables a user to produce and modify two main components of Pay Button.

  • HTML tags with certain properties that function as placeholders of the button; this document will describe how to set this component.

  • Javascript components for dynamically using and setting global PIP button components; document will explain this point.

HTML PIP Button is the wrapper with Javascript. Some of the details are skipped in this document, so visit 🔗JAVASCRIPT to find more.

Defining the button with HTML

When the document is successfully loaded, the script will automatically detect classes or properties including and converts them to components of PIP Buttons.

<!-- place your button(s) anywhere you want in your HTML -->
<div class="pip-button"
  data-receiver="GrWtQjkcEMQWKo4xfj6yfyRw2skNyubuXKU..."
  data-amount="1"
	data-chainNetwork="SOLANA"
  data-currency="SOL"
></div>

PIP-BUTTON can have properties as below:

data-receiver

true

string

null

data-amount

true

string

null

data-currency

true

string

‘USDC’

data-chainNetwork

false

string

‘SOLANA’

data-label

false

string

‘PAY’

data-useLabel

false

boolean

true

data-buttonColor

false

string

‘#1149FF’

data-buttonTextColor

false

string

‘#FFFFFF’

data-load

false

string

null

data-payment

false

string

null

data-error

false

string

null

data-memo

false

string

null

data-receiver

A receiver’s address that is compatible with a selected blockchain

data-amount

The amount of dollar (Fiat) that a receiver will receive

data-chainNetwork

The type of blockchain network that the symbol of the token is included

data-currency

The symbol of the token will actually be sent to the receiver

data-label

A label of the button

data-useLabel

Option to display the label of the button. The default value is ‘TRUE’.

data-buttonColor

The background color of the button

data-buttonTextColor

Text color of the button

data-memo

The text that is included in the transaction.

data-payment

Function(s) that will be executed when the payment is successful.

<script>
function callback (payment) {
   console.log('A payment has occurred!', payment)
}

</script><div class="pip-button"
  data-receiver="receiver address"
  data-amount="amount"
	data-chainNetwork="chainNetwork"
  data-currency="currency"
  data-payment="callback"
></div>

When the payment is successful, values listed below are transferred.

Name
Type
Description

sender

string

Sender’s public key

amount

string

The amount of USD sent

chainNetwork

string

The type of blockchain network that the symbol of the token is included. (i.e. SOLANA, BSC)

currency

string

The ticker of token that is sent.

txId

string

Transaction id

data-error

Function(s) that will be executed when the payment is NOT successful. It will not be executed when there is a problem with the parameters of the button.

Parameters that the function receives is the explanation of the error.

<script>
function callback (error) {
    console.log(`Something went wrong: ${error}`)
  }
</script>

<div class="pip-button"
  data-receiver="receiver address"
  data-amount="amount"
	data-chainNetwork="chainNetwork"
  data-currency="currency"
  data-error="callback"
></div>

data-load

The function that is executed when the button is loaded.

<script>
function callback (error) {
    console.log(`The button has loaded.`)
  }
</script>

<div class="pip-button"
  data-receiver="receiver address"
  data-amount="amount"
	data-chainNetwork="chainNetwork"
  data-currency="currency"
  data-load="callback"
></div>
🔷
🔗JAVASCRIPT