Skip to content
Create account or Sign in
The Stripe Docs logo
/
Ask AI
Create accountSign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
APIs & SDKsHelp
OverviewAccept a paymentUpgrade your integration
Online payments
OverviewFind your use case
Use Payment Links
    Overview
    Create a payment link
    Share a payment link
    Track a payment link
    Create a buy button
    Customize checkout for payment links
    Charge for shipping
    Promotion codes, optional items, and upsells
    After you receive payment from a payment link
Use a prebuilt checkout page
Build a custom integration with Elements
Build an in-app integration
Use Managed Payments
Recurring payments
In-person payments
Terminal
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment operations
Analytics
Balances and settlement time
Compliance and security
Currencies
Declines
Disputes
Fraud prevention
Radar fraud protection
Payouts
ReceiptsRefunds and cancellations
Advanced integrations
Custom payment flows
Flexible acquiring
Off-Session Payments
Multiprocessor orchestration
Beyond payments
Incorporate your company
Crypto
Agentic commerce
Machine payments
Financial Connections
Climate
Verify identities
United States
English (United States)
HomePaymentsUse Payment Links

Track a payment link

Use URL parameters and UTM codes to track a payment link.

Modify your payment link with URL parameters and Urchin Tracking Module (UTM) codes to get insight into customer behaviors and your marketing strategy’s effectiveness. These tools help identify the source of your traffic and the marketing campaigns leading to the most conversions.

Track campaigns with UTM codes

Use UTM codes to track how customers find your site when they pay using your payment link. You can add the following UTM codes as parameters in the query string of your URL: utm_source, utm_content, utm_medium, utm_term, and utm_campaign.

ParameterDescription
utm_sourceIdentifies where the traffic originated (for example, a website name, social media, or a search engine).
utm_contentIdentifies what content your customer chooses. Use this parameter to distinguish between links that point to the same payment page.
utm_mediumIdentifies the marketing medium that accesses your payment link (for example, email, cost per click (cpc), or other methods).
utm_termIdentifies specific search terms and keywords in your paid search ads.
utm_campaignIdentifies your marketing campaigns using the payment link URL.

To add UTM codes, specify redirect as your confirmation behavior. When customers complete a payment, your redirect URL contains the UTM code parameters specified in your payment link URL. Here’s what a payment link looks like with an appended UTM codes: https://buy.stripe.com/test_eVa5nPg1j1wmfXq5kr?utm_medium=earned_email&utm_source=marketo&utm_campaign=campaign_a

Caution

Construct UTM codes using alphanumeric characters, dashes, or underscores, ensuring they don’t exceed a 150-character limit. Invalid values are discreetly discarded, guaranteeing your payment links performance remains unaffected.

Simplify reconciliation with a URL parameter

You can simplify reconciliation with the client_reference_id URL parameter. Use URL parameters in the query string of your payment link URL. To configure URL parameters directly in the Dashboard Payment Links page:

  1. Click the payment link you want to modify.
  2. Click the down arrow of the Copy button and select URL parameters.
  3. In the dialog, use the drop-down menu to select Client reference ID.
  4. Enter a value that meets the requirements described in the following table to append the reference to your URL.
  5. Copy the amended URL for use in your integration.
ParameterDescriptionSyntax
client_reference_idUse client_reference_id to attach a unique string of your choice to the Checkout Session. This can be a customer ID or a cart ID (or similar), and you can use it to reconcile the Session with your internal systems. If you add this parameter to your payment link, it’s sent in the checkout.session.completed webhook after payment completion.client_reference_id can be composed of alphanumeric characters, dashes, or underscores, and be any value up to 200 characters. Invalid values are silently dropped, but your payment page continues to work as expected.

Track payments with the API

When customers use a payment link to complete a payment, Stripe sends a checkout.session.completed webhook that you can use for fulfillment and reconciliation. Learn more about receiving Stripe events in your integration.

Make sure to listen to additional webhooks in case you’ve enabled payment methods like bank debits or vouchers, which can take 2-14 days to confirm the payment. For more information, see our guide on fulfilling orders after a customer pays.

After a customer completes a purchase, you can redirect them to a URL or display a custom message by setting after_completion on the payment link.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/payment_links \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "line_items[0][price]"=
"{{PRICE_ID}}"
\ -d "line_items[0][quantity]"=1 \ -d "after_completion[type]"=redirect \ --data-urlencode "after_completion[redirect][url]"="https://example.com"
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc