lets say I have an ecommerce website and I want to start accepting Solana.
The customer will fill the cart and proceed to the checkout page, there I can display a QR code where the user can scan to pay.
Now I want to know if the checkout has been paid so I can mark the order as paid, is there a good way to accomplish that? maybe using Solana pay I can pass a reference or something?
You can use the validateTransfer
method to do that
validateTransfer allows you to validate that the transaction signature found matches the transaction that you expected.
try {
await validateTransfer(connection, signature, {
recipient: MERCHANT_WALLET,
amount
});
// Update payment status
paymentStatus = 'validated';
console.log('✅ Payment validated');
console.log('📦 Ship order to customer');
} catch (error) {
console.error('❌ Payment failed', error);
}
check out the solana documentation for this