Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@solana/pay
Advanced tools
Payments SDK based around the token transfer URL scheme defined here: https://github.com/solana-labs/solana/issues/19535
Payments SDK based around the token transfer URL scheme defined here: https://github.com/solana-labs/solana/issues/19535
There are some parts of a JS reference implementation here, but we will want to think about mobile (iOS, Android, React Native) as well.
There are a few user flows that we have in mind.
Transactions can be created by the app, signed by the wallet, and sent by the app.
In this flow, the SDK just wraps wallet-adapter, and makes it easy for merchant apps to send transactions. Connecting to the wallet first like dapps currently do is required, since the app needs the user's public key to send the transaction.
Payment requests can be encoded as a URL according to the scheme, scanned using a QR code, sent and confirmed by the wallet, and discovered by the app. Unlike WalletConnect, this isn't general purpose, it's just for token transfers. There is no step to connect a wallet or create a session.
In this flow, the app generates a unique public key representing the transfer request. The SDK encodes a URL referencing this key. Upon presenting the QR code, the app starts subscribing to or polling the RPC for transactions that reference the unique key.
The user scans the link with their camera or mobile wallet. The wallet handles the link, parses the URL, create the payment transaction as is done in the reference implementation, signs, sends, and confirms it.
The app discovers the confirmed transaction by looking for the unique public key it references. The app should optimistically persist the key, so the payment can go through on the wallet side, and then the app or merchant's API can find and associate the payment to a user or sale afterwards.
Payment requests can be encoded as a URL, a deep link, another format using App Extensions on iOS and Intent/Activity on Android, or some other mechanism TBD.
The app prepares a payment request, and passes control to the wallet. The wallet signs, sends, and confirms it, or cancels the request.
The wallet returns control to the app along with the transaction signature or some other data TBD.
FAQs
`@solana/pay` is a JavaScript library for facilitating commerce on Solana by using a token transfer URL scheme. The URL scheme ensures that no matter the wallet or service used, the payment request must be created and interpreted in one standard way.
The npm package @solana/pay receives a total of 1,278 weekly downloads. As such, @solana/pay popularity was classified as popular.
We found that @solana/pay demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.