npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

pay-decentral

v1.0.7

Published

PayDecentral PayDecentral is an easy-to-use npm package built on top of the @solana/pay SDK. It allows seamless integration of decentralized Solana payments into your web platform, with support for payment modals and user data retrieval.

Downloads

129

Readme

PayDecentral PayDecentral is an easy-to-use npm package built on top of the @solana/pay SDK. It allows seamless integration of decentralized Solana payments into your web platform, with support for payment modals and user data retrieval.

Table of Contents Installation Usage Features API Documentation Contributing License Changelog Installation To get started with PayDecentral, install the package via npm or yarn:

Using npm: bash Copy code npm install pay-decentral Using yarn: bash Copy code yarn add pay-decentral Usage

  1. Import the Package Once installed, you can import the PaymentModalWithProvider and getUserData functions from the package:

javascript Copy code import { PaymentModalWithProvider, getUserData } from 'pay-decentral'; 2. Initialize the Payment Modal The PaymentModalWithProvider component allows you to display a payment modal to your users. You need to provide it with necessary props like subscriptionPlans, developerWallet, and developerApiKey.

javascript Copy code import { useState, useEffect } from 'react'; import { PaymentModalWithProvider, getUserData } from 'pay-decentral';

const Docs = () => { const [isOpen, setIsOpen] = useState(false); const [developerWallet, setDeveloperWallet] = useState('YourSolanaWalletAddress'); const [developerApiKey, setDeveloperApiKey] = useState('YourAPIKey');

const subscriptionPlans = [ { id: "plan1", name: "Basic Plan", amount: "0.001" }, { id: "plan2", name: "Pro Plan", amount: "0.002" }, { id: "plan3", name: "Premium Plan", amount: "0.003" }, ];

const handleOpenModal = () => { setIsOpen(true); };

const handleCloseModal = () => { setIsOpen(false); };

return ( Pay with Solana

  <PaymentModalWithProvider
    subscriptionPlans={subscriptionPlans}
    userEmail="[email protected]"
    developerApiKey={developerApiKey}
    isOpen={isOpen}
    onClose={handleCloseModal}
    developerWallet={developerWallet}
    onPaymentVerified={(planId, transactionSignature) => {
      console.log(`Payment for ${planId} verified with transaction ${transactionSignature}`);
    }}
  />
</div>

); };

export default Docs; 3. Get User Data You can use the getUserData function to fetch a user's payment status using your developer API key:

javascript Copy code useEffect(() => { const fetchUserData = async () => { try { const data = await getUserData('YourAPIKey'); console.log(data); // Logs user data like payment status } catch (err) { console.error("Error fetching user data: ", err); } };

fetchUserData(); }, []); Features Built on top of the @solana/pay SDK, offering a reliable and secure payment solution. Provides an easy-to-integrate modal for Solana payments. Includes functions to fetch user payment status with your developer API key. Supports multiple subscription plans and customizable payment amounts in SOL. Simple API to trigger payments and verify transactions. API Documentation PaymentModalWithProvider A React component that displays a payment modal and facilitates Solana payments.

Props: subscriptionPlans: An array of objects defining the available subscription plans. Each plan object should include an id, name, and amount.

Example:

javascript Copy code const subscriptionPlans = [ { id: 'plan1', name: 'Basic Plan', amount: '0.001' }, { id: 'plan2', name: 'Pro Plan', amount: '0.002' }, { id: 'plan3', name: 'Premium Plan', amount: '0.003' }, ]; userEmail: The email of the user making the payment (optional but recommended).

developerApiKey: Your developer API key for interacting with the PayDecentral API.

isOpen: A boolean that controls whether the modal is open or closed.

onClose: A callback function to close the modal when triggered.

developerWallet: The wallet address where funds will be sent after payment.

onPaymentVerified: A callback function triggered when a payment is successfully verified. This function receives two arguments: planId and transactionSignature.

getUserData A function used to fetch the payment status of your users.

Parameters: developerApiKey: Your developer API key to authenticate the request. Returns: An object containing the user's payment details, including the plan, transaction signature, and wallet address. javascript Copy code const userData = await getUserData(developerApiKey); console.log(userData); // Example output: { createdAt: "2024-11-30T18:12:19.550Z", email: "[email protected]", planId: "Basic", transactionSignature: "38J...sF1", walletAddress: "7t...nh" }

License This project is licensed under the MIT License - see the LICENSE file for details.

Changelog v1.0.0 (2024-12-01) Initial release of PayDecentral with basic Solana payment modal integration. Functionality to fetch user payment status with developer API key.