Redirect Flow
Handling user returns after payment.
Overview
When you create a Payment Link, you must provide a success_url. Once the user completes the payment on our hosted page, they will see a success confirmation, and after 3 seconds, they will be automatically redirected to your URL.
This allows you to verify the payment status and show a “Thank You” page on your own domain.
Query Parameters
We append the following parameters to your success_url so you can identify the transaction:
payment_id: The ID of the Payment Link (e.g.,pl_...).source_tx_hash: The blockchain transaction hash of the original payment.status: The status of the payment (alwayscompletedfor success redirects).
https://myapp.com/success?payment_id=pl_123&source_tx_hash=0xabc...&status=completedVerification (Critical)
Do not trust the URL parameters alone. A malicious user could manually type ?status=completed in their browser to spoof a successful payment.
The recommended approach is to use webhooks to receive real-time notifications when payments complete or fail. Alternatively, verify the transaction status using our API before fulfilling the order.
Recommended Flow
- User completes payment and is redirected to your
success_url. - Your backend captures the
payment_idfrom the query parameters. - Your backend calls
GET /transactions?payment_link_id=...to confirm the status is actuallycompleted. - If verified, fulfill the order.
// 1. Get payment_id from URL query
const paymentId = req.query.payment_id;
// 2. Call API to verify
const response = await fetch(`https://flash-protocol.vercel.app/api/v1/transactions?payment_link_id=${paymentId}`, {
headers: { 'Authorization': 'Bearer ...' }
});
const { data } = await response.json();
const transaction = data[0]; // Get latest transaction
if (transaction && transaction.status === 'completed') {
// ✅ Payment confirmed! Fulfill order.
} else {
// ❌ Fraud attempt or pending. Do not fulfill.
}