hedera-defi-payment
v1.0.7
Published
A lightweight React component for generating Hedera payment links.
Maintainers
Readme
hedera-defi-payment
A simple JavaScript/TypeScript SDK that helps you create secure Hedera payment links for merchants. With just a few details (merchant info, amount, and coin type), the SDK generates one encrypted payment URL that you can share with your customers.
:rocket: What does this SDK do?
- Takes basic payment details
- Encrypts them securely
- Generates one clean payment link
- Redirects the customer to your hosted payment page :white_tick: No blockchain knowledge required :white_tick: Safe to use on backend or frontend
:sparkles: Features
- Generate secure Hedera payment links
- Supports HBAR and USDC
- Encrypted payload (no raw data in URL)
- Very easy TypeScript interface
- Zero external dependencies
- Works with Node.js and browser apps
:package: Installation
Using npm:
npm install hedera-defi-paymentUsing yarn:
yarn add hedera-defi-payment:spanner: How to Use (Step by Step)
:one: Import the function
import { generatePaymentLink } from "hedera-defi-payment";:two: Create payment details
const details = {
merchant_name: "My Shop",
merchant_address: "0.0.123456",
amount: 49.99,
coin_name: "HBAR",
back_url: "https://myshop.com/payment-success",
};:three: Generate the payment link
const paymentURL = generatePaymentLink(details);
console.log(paymentURL);:link: Generated Payment URL (Example)
The SDK returns one secure URL like this:
https://pay.blockbolt.io/blockbolt:payment?data=ENCRYPTED_PAYLOADReal Example:
https://pay.blockbolt.io/blockbolt:payment?data=cSxFHFsqVLFKonr8ZYPQyA%3D%3D%3AE2le8mMWNp1FR55OAmgZMbvCxrbkhwpTM1GOsb9H4LjMVpRmHPMZG6brb4GH1O6UIXM4jIKJ6bC9pWvOeR0fNdetp%2Fhg9xBHWs8CFD3FQm4ijYjyoplLBMuYN%2FUeHixaOJ4eO0YY3nHipzYzxEIUfcvW19b3v4HQ9IUeIbMMj5IGESn0iG2nNJ%2FT%2F1%2FU%2Bzwq54Dd2Gli7S7Cazk2VJyvARmN5yn5gKd8g3bHkvCFa87HNtnzzQoUf0xPY23hwAOJfkmEbjKSVFNbirTXF6l2iw%3D%3DExmaple: How to use:
https://drive.google.com/file/d/1ucfB80gEKui69fWwocRy-bJXUtoPCbhA/view?usp=sharing:lock: Note: All payment information is encrypted inside the data
parameter. No merchant or amount details are visible in the URL.
:receipt: MerchantDetails Interface
interface MerchantDetails {
merchant_name: string;
merchant_address: string;
amount: number;
coin_name: "HBAR" | "USDC";
back_url: string;
}:closed_lock_with_key: Security Notes
- Payment data is encrypted before generating the link
- Safe to share the link publicly
- Prevents URL tampering
- Ideal for production use
:brain: Who should use this?
- Merchants accepting Hedera payments
- Developers building checkout pages
- SaaS platforms integrating crypto payments
- Mobile or web apps needing simple payment links
