Skip to content

Stripe: Create a payment link

Stripe paymentLinks.postPaymentLinks: arguments, response, policy and SDK examples.

← Payment links operations · Get started

Operation stripe.postpaymentlinks

Provider route: POST /v1/payment_links. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["paymentLinks"]["postPaymentLinks"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.paymentLinks.postPaymentLinks(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_stripe import StripeIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.payment_links.post_payment_links(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectRequired within parentAdditional keys: not allowed
body.after_completionobjectOptionalBehavior after the purchase is complete.
body.after_completion.hosted_confirmationobjectOptional
body.after_completion.hosted_confirmation.custom_messagestringOptionalMaximum length: 500
body.after_completion.redirectobjectOptional
body.after_completion.redirect.urlstringRequired within parent
body.after_completion.typestringRequired within parentOne of: hosted_confirmation, redirect
body.allow_promotion_codesbooleanOptionalEnables user redeemable promotion codes.
body.application_fee_amountintegerOptionalThe amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account. Can only be applied when there are no line items with recurring prices.
body.application_fee_percentnumberOptionalA non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account. There must be at least 1 line item with a recurring price to use this field.
body.automatic_taxobjectOptionalConfiguration for automatic tax collection.
body.automatic_tax.enabledbooleanRequired within parent
body.automatic_tax.liabilityobjectOptional
body.automatic_tax.liability.accountstringOptional
body.automatic_tax.liability.typestringRequired within parentOne of: account, self
body.billing_address_collectionstringOptionalConfiguration for collecting the customer’s billing address. Defaults to `auto`.
One of: auto, required
body.consent_collectionobjectOptionalConfigure fields to gather active consent from customers.
body.consent_collection.payment_method_reuse_agreementobjectOptional
body.consent_collection.payment_method_reuse_agreement.positionstringRequired within parentOne of: auto, hidden
body.consent_collection.promotionsstringOptionalOne of: auto, none
body.consent_collection.terms_of_servicestringOptionalOne of: none, required
body.currencystringOptionalThree-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies) and supported by each line item’s price.
Format: currency
body.custom_fieldsarrayOptionalCollect additional information from your customer using custom fields. Up to 3 fields are supported. You can’t set this parameter if `ui_mode` is `elements`.
body.custom_fields[]ModelEach itemExpand Create a payment link — request body — body custom fields item
body.custom_textModelOptionalExpand Create a payment link — request body — body custom text
body.customer_creationstringOptionalConfigures whether [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link create a [Customer](https://docs.stripe.com/api/customers).
One of: always, if_required
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
body.inactive_messagestringOptionalThe custom message to be displayed to a customer when a payment link is no longer active.
Maximum length: 500
body.invoice_creationModelOptionalExpand Create a payment link — request body — body invoice creation
body.line_itemsarrayRequired within parentThe line items representing what is being sold. Each line item represents an item being sold. Up to 20 line items are supported.
body.line_items[]objectEach item
body.line_items[].adjustable_quantityobjectOptional
body.line_items[].adjustable_quantity.enabledbooleanRequired within parent
body.line_items[].adjustable_quantity.maximumintegerOptional
body.line_items[].adjustable_quantity.minimumintegerOptional
body.line_items[].pricestringOptionalMaximum length: 5000
body.line_items[].price_dataModelOptionalExpand Create a payment link — request body — body line items item price data
body.line_items[].quantityintegerRequired within parent
body.managed_paymentsobjectOptionalSettings for Managed Payments for this Payment Link and resulting [CheckoutSessions](/api/checkout/sessions/object), [PaymentIntents](/api/payment_intents/object), [Invoices](/api/invoices/object), and [Subscriptions](/api/subscriptions/object).
body.managed_payments.enabledbooleanOptional
body.metadataobjectOptionalSet of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata associated with this Payment Link will automatically be copied to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
Additional keys: see wildcard field
body.metadata.*stringAdditional keys
body.name_collectionobjectOptionalControls settings applied for collecting the customer’s name.
body.name_collection.businessobjectOptional
body.name_collection.business.enabledbooleanRequired within parent
body.name_collection.business.optionalbooleanOptional
body.name_collection.individualobjectOptional
body.name_collection.individual.enabledbooleanRequired within parent
body.name_collection.individual.optionalbooleanOptional
body.on_behalf_ofstringOptionalThe account on behalf of which to charge.
body.optional_itemsarrayOptionalA list of optional items the customer can add to their order at checkout. Use this parameter to pass one-time or recurring [Prices](https://docs.stripe.com/api/prices).
There is a maximum of 10 optional items allowed on a payment link, and the existing limits on the number of line items allowed on a payment link apply to the combined number of line items and optional items.
There is a maximum of 20 combined line items and optional items.
body.optional_items[]objectEach item
body.optional_items[].adjustable_quantityobjectOptional
body.optional_items[].adjustable_quantity.enabledbooleanRequired within parent
body.optional_items[].adjustable_quantity.maximumintegerOptional
body.optional_items[].adjustable_quantity.minimumintegerOptional
body.optional_items[].pricestringRequired within parentMaximum length: 5000
body.optional_items[].quantityintegerRequired within parent
body.payment_intent_dataobjectOptionalA subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
body.payment_intent_data.capture_methodstringOptionalOne of: automatic, automatic_async, manual
body.payment_intent_data.descriptionstringOptionalMaximum length: 1000
body.payment_intent_data.metadataobjectOptionalAdditional keys: see wildcard field
body.payment_intent_data.metadata.*stringAdditional keys
body.payment_intent_data.setup_future_usagestringOptionalOne of: off_session, on_session
body.payment_intent_data.statement_descriptorstringOptionalMaximum length: 22
body.payment_intent_data.statement_descriptor_suffixstringOptionalMaximum length: 22
body.payment_intent_data.transfer_groupstringOptionalMaximum length: 5000
body.payment_method_collectionstringOptionalSpecify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.

Can only be set in `subscription` mode. Defaults to `always`.

If you’d like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://docs.stripe.com/payments/checkout/free-trials).
One of: always, if_required
body.payment_method_optionsobjectOptionalPayment-method-specific configuration.
body.payment_method_options.cardobjectOptional
body.payment_method_options.card.restrictionsobjectOptional
body.payment_method_options.card.restrictions.brands_blockedarrayOptional
body.payment_method_options.card.restrictions.brands_blocked[]stringEach itemOne of: american_express, discover_global_network, mastercard, visa
body.payment_method_typesarrayOptionalThe list of payment method types that customers can use. If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://docs.stripe.com/payments/payment-methods/integration-options#payment-method-product-support)).
body.payment_method_types[]stringEach itemOne of: affirm, afterpay_clearpay, alipay, alma, au_becs_debit, bacs_debit, bancontact, billie, bizum, blik, boleto, card, cashapp, eps, fpx, giropay, grabpay, ideal, klarna, konbini, link, mb_way, mobilepay, multibanco, oxxo, p24, pay_by_bank, paynow, paypal, paypay, payto, pix, promptpay, satispay, sepa_debit, sequra, sofort, sunbit, swish, twint, upi, us_bank_account, wechat_pay, zip
body.phone_number_collectionobjectOptionalControls phone number collection settings during checkout.

We recommend that you review your privacy policy and check with your legal contacts.
body.phone_number_collection.enabledbooleanRequired within parent
body.restrictionsobjectOptionalSettings that restrict the usage of a payment link.
body.restrictions.completed_sessionsobjectRequired within parent
body.restrictions.completed_sessions.limitintegerRequired within parent
body.shipping_address_collectionobjectOptionalConfiguration for collecting the customer’s shipping address.
body.shipping_address_collection.allowed_countriesarrayRequired within parent
body.shipping_address_collection.allowed_countries[]stringEach itemOne of: AC, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CV, CW, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MK, ML, MM, MN, MO, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SZ, TA, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, US, UY, UZ, VA, VC, VE, VG, VN, VU, WF, WS, XK, YE, YT, ZA, ZM, ZW, ZZ
body.shipping_optionsarrayOptionalThe shipping rate options to apply to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
body.shipping_options[]objectEach item
body.shipping_options[].shipping_ratestringOptionalMaximum length: 5000
body.submit_typestringOptionalDescribes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. Changing this value will also affect the hostname in the [url](https://docs.stripe.com/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`).
One of: auto, book, donate, pay, subscribe
body.subscription_dataobjectOptionalWhen creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
body.subscription_data.descriptionstringOptionalMaximum length: 500
body.subscription_data.invoice_settingsobjectOptional
body.subscription_data.invoice_settings.issuerobjectOptional
body.subscription_data.invoice_settings.issuer.accountstringOptional
body.subscription_data.invoice_settings.issuer.typestringRequired within parentOne of: account, self
body.subscription_data.metadataobjectOptionalAdditional keys: see wildcard field
body.subscription_data.metadata.*stringAdditional keys
body.subscription_data.trial_period_daysintegerOptional
body.subscription_data.trial_settingsobjectOptional
body.subscription_data.trial_settings.end_behaviorobjectRequired within parent
body.subscription_data.trial_settings.end_behavior.missing_payment_methodstringRequired within parentOne of: cancel, create_invoice, pause
body.tax_id_collectionobjectOptionalControls tax ID collection during checkout.
body.tax_id_collection.enabledbooleanRequired within parent
body.tax_id_collection.requiredstringOptionalOne of: if_supported, never
body.transfer_dataobjectOptionalThe account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
body.transfer_data.amountintegerOptional
body.transfer_data.destinationstringRequired within parent

Referenced models: Create a payment link — request body — body custom fields item, Create a payment link — request body — body custom text, Create a payment link — request body — body invoice creation, Create a payment link — request body — body line items item price data

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Create a payment link — response body

Referenced models: Create a payment link — response body

745 more schemas are linked from the tables above, on the schema pages.

Create a payment link — request body — body custom fields item
FieldTypePresenceDescription and constraints
$objectRoot
dropdownobjectOptional
dropdown.default_valuestringOptionalMaximum length: 100
dropdown.optionsarrayRequired within parent
dropdown.options[]objectEach item
dropdown.options[].labelstringRequired within parentMaximum length: 100
dropdown.options[].valuestringRequired within parentMaximum length: 100
keystringRequired within parentMaximum length: 200
labelobjectRequired within parent
label.customstringRequired within parentMaximum length: 100
label.typestringRequired within parentOne of: custom
numericobjectOptional
numeric.default_valuestringOptionalMaximum length: 255
numeric.maximum_lengthintegerOptional
numeric.minimum_lengthintegerOptional
optionalbooleanOptional
textobjectOptional
text.default_valuestringOptionalMaximum length: 255
text.maximum_lengthintegerOptional
text.minimum_lengthintegerOptional
typestringRequired within parentOne of: dropdown, numeric, text
Create a payment link — request body — body custom text
FieldTypePresenceDescription and constraints
$objectRootDisplay additional text for your customers using custom text. You can't set this parameter if `ui_mode` is `elements`.
after_submitJSONOptional
after_submit (anyOf 1)objectAlternative
after_submit (anyOf 1).messagestringRequired within parentMaximum length: 1200
after_submit (anyOf 2)stringAlternativeOne of:
shipping_addressJSONOptional
shipping_address (anyOf 1)objectAlternative
shipping_address (anyOf 1).messagestringRequired within parentMaximum length: 1200
shipping_address (anyOf 2)stringAlternativeOne of:
submitJSONOptional
submit (anyOf 1)objectAlternative
submit (anyOf 1).messagestringRequired within parentMaximum length: 1200
submit (anyOf 2)stringAlternativeOne of:
terms_of_service_acceptanceJSONOptional
terms_of_service_acceptance (anyOf 1)objectAlternative
terms_of_service_acceptance (anyOf 1).messagestringRequired within parentMaximum length: 1200
terms_of_service_acceptance (anyOf 2)stringAlternativeOne of:
Create a payment link — request body — body invoice creation
FieldTypePresenceDescription and constraints
$objectRootGenerate a post-purchase Invoice for one-time payments.
enabledbooleanRequired within parent
invoice_dataModelOptionalExpand Create a payment link — request body — body invoice creation invoice data

Referenced models: Create a payment link — request body — body invoice creation invoice data

Create a payment link — request body — body line items item price data
FieldTypePresenceDescription and constraints
$objectRoot
currencystringRequired within parentFormat: currency
productstringOptionalMaximum length: 5000
product_dataModelOptionalExpand Update an invoice's line item — request body — body price data product data
recurringobjectOptional
recurring.intervalstringRequired within parentOne of: day, month, week, year
recurring.interval_countintegerOptional
tax_behaviorstringOptionalOne of: exclusive, inclusive, unspecified
unit_amountintegerOptional
unit_amount_decimalstringOptionalFormat: decimal

Referenced models: Update an invoice's line item — request body — body price data product data

PostApplicationFeesIdRefund — response body — application / object: application
FieldTypePresenceDescription and constraints
$objectRoot
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
nameJSONOptional
name (anyOf 1)stringAlternativeThe name of the application.
Maximum length: 5000
name (anyOf 2)nullAlternative
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: application
Accept a quote — response body — application / value / deleted: True, object: application
FieldTypePresenceDescription and constraints
$objectRoot
deletedbooleanRequired within parentAlways true for a deleted object
Known values: True
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
nameJSONOptional
name (anyOf 1)stringAlternativeThe name of the application.
Maximum length: 5000
name (anyOf 2)nullAlternative
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: application
Create a payment link — response body — after completion
FieldTypePresenceDescription and constraints
$objectRoot
hosted_confirmationModelOptionalExpand Create a payment link — response body — after completion hosted confirmation
redirectModelOptionalExpand Create a payment link — response body — after completion redirect
typestringRequired within parentThe specified behavior after the purchase is complete.
Known values: hosted_confirmation, redirect

Referenced models: Create a payment link — response body — after completion hosted confirmation, Create a payment link — response body — after completion redirect

Create a payment link — response body — automatic tax
FieldTypePresenceDescription and constraints
$objectRoot
enabledbooleanRequired within parentIf `true`, tax will be calculated automatically using the customer's location.
liabilityJSONOptional
liability (anyOf 1)JSONAlternativeThe account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
liability (anyOf 1) (anyOf 1)ModelAlternativeExpand Pay an invoice — response body — issuer
liability (anyOf 2)nullAlternative

Referenced models: Pay an invoice — response body — issuer

Create a payment link — response body — consent collection value payment method reuse agreement, promotions, terms of service
FieldTypePresenceDescription and constraints
$objectRoot
payment_method_reuse_agreementJSONOptional
payment_method_reuse_agreement (anyOf 1)JSONAlternativeSettings related to the payment method reuse text shown in the Checkout UI.
payment_method_reuse_agreement (anyOf 1) (anyOf 1)ModelAlternativeExpand Create a payment link — response body — consent_collection / value / payment_method_reuse_agreement, promotions, terms_of_service / payment_method_reuse_agreement / value / position: auto, hidden
payment_method_reuse_agreement (anyOf 2)nullAlternative
promotionsJSONOptional
promotions (anyOf 1)stringAlternativeIf set to `auto`, enables the collection of customer consent for promotional communications.
Known values: auto, none
promotions (anyOf 2)nullAlternative
terms_of_serviceJSONOptional
terms_of_service (anyOf 1)stringAlternativeIf set to `required`, it requires cutomers to accept the terms of service before being able to pay. If set to `none`, customers won't be shown a checkbox to accept the terms of service.
Known values: none, required
terms_of_service (anyOf 2)nullAlternative

Referenced models: Create a payment link — response body — consent_collection / value / payment_method_reuse_agreement, promotions, terms_of_service / payment_method_reuse_agreement / value / position: auto, hidden

Create a payment link — response body — phone number collection
FieldTypePresenceDescription and constraints
$objectRoot
enabledbooleanRequired within parentIf `true`, a phone number will be collected during checkout.

SDK function policy ID: stripe.postpaymentlinks. Catalog operation: PostPaymentLinks. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"Stripe-Version": "2026-09-30.endive"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.