Stripe PaymentLink — Complete Guide to No-Code Checkout
In this tutorial, you will learn about Stripe PaymentLink. We cover key concepts, practical examples, and best practices to help you master this topic.
Stripe PaymentLink creates shareable checkout URLs for products and subscriptions without writing code, supporting one-time payments, recurring billing, and customizable payment pages.
What You'll Learn
- Creating PaymentLinks for products and prices
- Customizing payment page appearance and behavior
- Tracking PaymentLink analytics and conversions
Why It Matters
Building a full checkout flow requires frontend code, backend integration, and Webhook handling. PaymentLink provides a Stripe-hosted checkout page with zero frontend code.
Real-World Use
Durga Antivirus Pro uses PaymentLinks for invoice payments: each invoice includes a unique PaymentLink that takes the customer to a Stripe-hosted page to pay with card or wallet, no login required.
flowchart LR
M["Merchant"] --> P["Create PaymentLink"]
P --> U["Share URL"]
U --> C["Customer"]
C --> S["Stripe Checkout Page"]
S --> D["Payment Done"]
style P fill:#dbeafe,stroke:#2563eb
Code Examples
import stripe
stripe.api_key = 'sk_test_...'
# Create a simple PaymentLink for a product
product = stripe.Product.create(name='Durga Antivirus Pro - 1 Year')
price = stripe.Price.create(
product=product.id,
unit_amount=4999,
currency='usd',
)
payment_link = stripe.PaymentLink.create(
line_items=[{'price': price.id, 'quantity': 1}],
)
print(f"Payment Link URL: {payment_link.url}")
Expected output: Shareable URL like https://buy.stripe.com/test_abc123 that opens a Stripe checkout page.
# PaymentLink with subscription and customization
import stripe
stripe.api_key = 'sk_test_...'
payment_link = stripe.PaymentLink.create(
line_items=[{'price': 'price_monthly', 'quantity': 1}],
subscription_data={'trial_period_days': 14},
after_completion={
'type': 'redirect',
'redirect': {'url': 'https://durgaantivirus.com/welcome'}
},
billing_address_collection='required',
phone_number_collection={'enabled': True},
metadata={'campaign': 'summer_2026'},
)
print(f"Subscription link: {payment_link.url}")
Expected output: PaymentLink with 14-day free trial, redirect after payment, and required billing details.
// Creating PaymentLink via Stripe API (Node.js)
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
async function createInvoiceLink(invoiceId, amount) {
const price = await stripe.prices.create({
currency: 'usd',
unit_amount: amount,
product_data: { name: `Invoice ${invoiceId}` },
});
const paymentLink = await stripe.paymentLinks.create({
line_items: [{ price: price.id, quantity: 1 }],
metadata: { invoice_id: invoiceId },
});
return paymentLink.url;
}
createInvoiceLink('INV-001', 2999).then(url => {
console.log('Invoice payment link:', url);
});
Expected output: Invoice-specific PaymentLink generated for one-time payment.
Common Mistakes
1. Creating Duplicate Products and Prices
Each PaymentLink creates a new Price if not reused. Create Products/Prices once and reference them by ID.
2. No After-Completion Action
Without after_completion, customers see a generic success page. Redirect to your own thank-you page.
3. Ignoring Tax Configuration
PaymentLinks do not automatically calculate tax. Use Stripe Tax or pre-calculated tax-inclusive prices.
4. Not Testing in Test Mode
Always test PaymentLinks with test mode keys before going live. Test mode payments do not charge real cards.
5. Missing Metadata for Tracking
Without metadata, you cannot identify which PaymentLink generated a payment. Always include campaign or source metadata.
Practice Questions
- What is a PaymentLink and when should you use it?
- How does PaymentLink differ from a custom Checkout Session?
- Why should you reuse Product and Price IDs across PaymentLinks?
- How do you redirect customers after payment completion?
- How can you track which PaymentLink generated a sale?
Answers:
- A PaymentLink is a shareable Stripe-hosted checkout URL for products or subscriptions.
- Checkout Session requires frontend integration; PaymentLink works with just a URL.
- Reusing IDs avoids duplicating products/prices in the Stripe dashboard and simplifies reporting.
- Set after_completion.type to 'redirect' with your return URL.
- Use metadata on the PaymentLink and filter payments by metadata in the Stripe dashboard or API.
Challenge: Create a PaymentLink system for a SaaS product with three plans (Basic $9/mo, Pro $29/mo, Enterprise $99/mo). Each PaymentLink includes a 14-day trial, redirects to a welcome page, and tracks the plan type via metadata.
FAQ
Mini Project
Build a product catalog where each product has a "Buy Now" button that generates a PaymentLink on the fly. Include: product selection, quantity picker, custom amount for donations, and tracking metadata. Display the generated URL for sharing.
What's Next
Learn about Stripe Checkout Session for full customization, or explore Stripe Subscriptions for recurring billing with PaymentLinks.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro