Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
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
    Collect addresses
    Charge for shipping
    Promotion codes, optional items, and upsells
    After you receive payment from a payment link
    Use the API to create and manage a payment link
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Payments
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
Understand fraud
Radar fraud protection
Manage disputes
Verify identities
HomePaymentsUse Payment Links

Use the API to create and manage payment links

Create and manage payment links with the API.

You can use the Payment Links API to create a payment link that you can share with your customers. Stripe redirects customers who open this link to a Stripe-hosted payment page.

Set up your product catalog

Payment Links use Products and Prices to model what your business is selling. To get started with Payment Links, create a product, then use that product to create a price. Alternatively, if you want to create an ad-hoc price or product for one-time use, you can skip this step and use price_data in step 2.

Payment Links supports flat rate, tiered, package and Customer chooses (letting your customer specify the price) prices. Customer choose prices currently doesn’t support recurring payments or donations.

Use Flat rate to create a product or subscription with a fixed amount.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/prices \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d currency=usd \ -d unit_amount=1000 \ -d product=
{{PRODUCT_ID}}

Create a payment link

To create a payment link, pass in line_items. Each line item contains a price (or price_data) and quantity. Payment links can contain up to 20 line items when using a flat rate and 1 line item when using Customer chooses price.

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

Share your payment link

Each payment link contains a url that you can share with your customers through email, on social media, with a website link, in an app, or through other channels.

Track payments

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.

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"

Deactivate a payment link

After you’ve created a payment link, you can’t delete it. What you can do is deactivate a payment link by setting the active attribute to false.

After you deactivate a link, customers can’t finalize purchases using the link anymore and are redirected to an expiration page. If you want to reuse a deactivated payment link, turn it back on by setting the active attribute to true.

Configure payment methods

By default, Stripe selects the relevant payment methods that you enabled in your Dashboard. To add supported payment methods, enable them in your Payment methods settings.

OptionalAllow coupons and promotion codes

Create and configure coupons and promotion codes for your payment links by using the Dashboard or Promotion Code API:

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 allow_promotion_codes=true

OptionalCollect taxes on your payment link

Payment Links work with Stripe Tax to let you calculate and collect tax on your payments. Stripe Tax is a paid product that automatically calculates tax on your transactions without the need to define the rates and rules.

To get started, activate Stripe Tax in your Dashboard. After you set up Stripe Tax, you can enable it on a new 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 "automatic_tax[enabled]"=true

To learn more about how to set up your product catalog to work with Stripe Tax, see Specify product tax codes and tax behavior.

OptionalCollect billing and shipping addresses

Payment links automatically collect your customer’s billing address when it’s required for completing the purchase. You can also update your payment link to always collect the billing address with billing_address_collection. Or you can collect your customer’s shipping address by specifying the supported countries with shipping_address_collection:

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 billing_address_collection=required \ -d "shipping_address_collection[allowed_countries][0]"=US

If you’re collecting shipping addresses, you can also add shipping rates to your payment link by passing an array of shipping_options:

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 billing_address_collection=required \ -d "shipping_address_collection[allowed_countries][0]"=US \ -d "shipping_options[0][shipping_rate]"=
{{SHIPPING_RATE_ID}}

OptionalAllow adjustable quantities

To allow your customers to update the quantity of the items they purchase, specify adjustable_quantity for the line item. You can also set the minimum and maximum quantities that customers can purchase:

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 "line_items[0][adjustable_quantity][enabled]"=true \ -d "line_items[0][adjustable_quantity][minimum]"=1 \ -d "line_items[0][adjustable_quantity][maximum]"=10

OptionalCreate subscriptions

To create a subscription using a payment link, specify a price with type=recurring for line_items. You can use subscription_data to specify the configuration for the subscriptions created from the payment link, including trials:

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 "subscription_data[trial_period_days]"=7

OptionalSpecify the payment methods you want to accept

To specify a different set of payment methods, set the payment_method_types parameter when you create 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 "payment_method_types[0]"=card \ -d "payment_method_types[1]"=klarna

Some payment methods like bank debits or vouchers might take between 2 and 14 days to confirm the payment. Set up webhooks to send you notifications once the payment gets cleared so you can begin fulfillment.

Your customers will see Apple Pay or Google Pay options if they’ve activated those methods on their device. The payment methods your customers see also depend on the browser they’re using.

OptionalCollect a terms of service agreement

Collect terms of service agreement from your customers by setting consent_collection.terms_of_service to required. This displays a checkbox for collecting the customer’s terms of service agreement, and links the customer to the terms of service URL set in your Stripe Dashboard’s Public details.

If you set consent_collection.terms_of_service to none, Checkout won’t display the checkbox and won’t require customers to accept your terms of service.

Before requiring agreement to your terms, set your terms of service URL in your business’s Public details. Setting a privacy policy URL is optional—Checkout also links to your privacy policy when a URL to your Privacy policy is set in your Public details.

Command Line
curl
Ruby
Python
PHP
Node.js
No results
curl https://api.stripe.com/v1/payment_links \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[0]"=card \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=2 \ -d "consent_collection[terms_of_service]"="required"

OptionalAdd custom fields

Caution

Don’t use custom fields to collect protected or sensitive data, or information restricted by law.

Create a payment link while specifying an array of custom fields. Each field must have a unique key that your integration uses to reconcile it. Also provide a label for the field that you display to your customer. Labels for custom fields aren’t translated, but you can use the locale URL parameter to set the language of your payment link to match the same language as your labels.

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 "custom_fields[0][key]"=engraving \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Personalized engraving" \ -d "custom_fields[0][type]"=text

After your customer completes the Checkout Session, the fields are available in the payments details page in the Dashboard or you can retrieve the completed custom fields.

OptionalCollect application fees using Connect

You can collect an application fee for every payment made with a Payment Link. Refer to our guide on how to collect application fees with the Payment Links API.

OptionalSend post-payment invoices

You can configure Payment Links to send detailed Invoices to your customers for successful one-time payments. Invoice creation for one-time payments in Payment Links is an Invoicing feature, and is priced separately.

Note

Payment Links for subscriptions create invoices automatically, and require no additional configuration.

To enable invoice creation on a Payment Link, set invoice_creation[enabled] to true:

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 "invoice_creation[enabled]"=true

You can use the invoice_data hash inside invoice_creation to customize the invoice:

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 "invoice_creation[enabled]"=true \ -d "invoice_creation[invoice_data][description]"="Invoice for Product X" \ -d "invoice_creation[invoice_data][metadata][order]"=order-xyz \ -d "invoice_creation[invoice_data][account_tax_ids][0]"=DE123456789 \ -d "invoice_creation[invoice_data][custom_fields][0][name]"="Purchase Order" \ -d "invoice_creation[invoice_data][custom_fields][0][value]"=PO-XYZ \ -d "invoice_creation[invoice_data][rendering_options][amount_tax_display]"=include_inclusive_tax \ -d "invoice_creation[invoice_data][footer]"="B2B Inc."

After the session, Stripe sends an invoice summary to the email address your customer provides during checkout. The invoice summary contains links to download the invoice PDF and invoice receipt.

Receipts for payments created with your test API keys aren’t sent automatically. View or manually send a receipt using the Dashboard.

Screenshot of the invoice PDF that customers can download from the invoice summary email

Let your customers download the invoice PDF

Screenshot of the invoice receipt that customers can download from the invoice summary email

Let your customers download the invoice receipt

Screenshot of the invoice summary email Stripe sends

Email links to download the invoice PDF or receipt

Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access program.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc