How to process Solana pay deeplink/ qr code on testnet?

How to process Solana pay deeplink/ qr code on testnet?

Manage alerts

Loading saved threads...

Anonymous-ahole · External communityPost link
External question — Solana Stack Exchange Author: Anonymous-ahole Original post: https://solana.stackexchange.com/questions/15978 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am using typescript with node and returning my Solana responses using a telegram bot. I want to simply do a transfer using a deep link from Solana pay to the provided wallet address. I have successfully obtained a url and qr code from Solana pay on testnet using this code snippet: const generateSolanaPayLink = (destinationPublicKey: string, amountSOL: number): string => { const amount = new BigNumber(amountSOL); const recipient = new PublicKey(destinationPublicKey); const reference = keypair.publicKey; const label = 'Test SOL transfer'; const message = 'SOL transfer '; const memo = 'JC#4098'; const url = encodeURL({ recipient, amount, reference, label, message, memo }); return url.href; }; // Function to convert Data URL to Buffer function dataURLToBuffer(dataURL: string): Buffer { const base64Data = dataURL.replace(/^data:image\/png;base64,/, ''); return Buffer.from(base64Data, 'base64'); } const generateQRCode = async (destinationPublicKey: string, amountSOL: number): Promise<Buffer> => { const solanaPayLink = generateSolanaPayLink(destinationPublicKey, amountSOL); try { const qrCodeDataURL = await qrCode.toDataURL(solanaPayLink); const qrCodeBuffer = dataURLToBuffer(qrCodeDataURL); return qrCodeBuffer; } catch (error) { console.error('Error generating QR code:', error); throw new Error('Failed to generate QR code'); } }; The issue that I am having is once I open this qr code in phantom the details are all there, but the payment does not process. I know that these qr codes are a way of signing, but how do I know once someone has accessed this qr code to continue with the transaction? I saw that it might require Https as well which I do not have as I am working locally. I noticed Solana pay also has transfer requests, in which you define endpoints so you can inject your own code there, and I don't know whether that is the more correct way to go about it. I have all these bits and pieces of info but have been unable to tie them all together. Please may someone assist with some code examples and the best way to work with Solana pay?
Quote
Report
amilz · External communityPost link
External answer — Solana Stack Exchange Author: amilz Original post: https://solana.stackexchange.com/a/16000 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. What kind of error are you getting in Phantom? Have you made sure to configure your wallet to the same network as your Solana Pay? You can do this in the wallet's developer settings--based on your post above you'll need to select Testnet.
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Solana Stack Exchange Author: amilz Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/a/16000 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. What kind of error are you getting in Phantom? Have you made sure to configure your wallet to the same network as your Solana Pay? You can do this in the wallet's developer settings--based on your post above you'll need to select Testnet.

Cancel quote

Checking account access…