Create a payment link
Creates a new payment link object.
Parameters
- Themodeof the Checkout Session. If not specified, it will be inferred from the recurring field values of the prices passed. However, it is required when usingsetupmode. Optionally, you can passsubscriptionif the Checkout Session includes at least one recurring item.
Possible enum values- payment
- Accept one-time payments for cards,iDEAL, and more.
- setup
- Save payment details to charge your customers later. Premium subscription required.
- subscription
- Use Stripe Billing to set up fixed-price subscriptions.
- The URL the customer will be directed to when payment or setup is complete. This url will automatically have the Checkoutsession_idappended to it. By default, this URL will be the standard PriceBlocs checkout complete success page. This value cannot be set dynamically via query string param.Learn more about default redirect urlshere.
- The URL the customer will be directed to if they decide to cancel the active Checkout Session. By default this will be the account profile url of the connected Stripe account, otherwise it will be the stanard PriceBlocs checkout error page. Can be set dynamically via query string param.Learn more about default redirect urlshere.
- ID of an existing Customer within your connected Stripe account, if one exists. If the Customer specified does not exist, an error will be thrown. Inpaymentmode, the customer’s most recent card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. Insubscriptionmode, the customer’s default payment method will be used if it’s a card, and otherwise the most recent card will be used. A valid billing address is required for Checkout to prefill the customer’s card details.
- If the customer changes their email on the Checkout page, the Customer object will be updated with the new email.
- If blank for Checkout Sessions in payment or subscription mode, Checkout will create a new Customer object based on information provided during the payment flow.
- If provided, this value will be used to search existing Customer's in your Stripe account to find a match. If found, the Payment Link response will have its email and customer field filled with the matched Customer's details. Any Checkout session initialized from such a Payment Link, will then be created in the context of that matched Customer.
- If a Customer match is not found for the email passed, only the email field will be set. Any Checkout session initialized from an email only Payment Link will then only have its email field prefilled, unless a Customer with such an email has been created since the time of link creation.
- Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata keys have a 40 character limit and their values have a 500 character limit. Metadata values will be copied into either thesubscription_dataorpayment_intent_datadepending on the context of the Checkout session.
More parameters
Expand all
Returns
- Returns a payment link object if the call succeeded.
Have any questions or feedback?
or join us on Discord
POST
/v1/payment-links
1curl https://api.priceblocs.com/v1/payment-links \2-H "Authorization: Bearer {{API_KEY_SECRET_TEST}}" \3-H 'Content-Type: application/json' \4--data-raw '{"line_items":[{"price":"{{PRICE_ID}}"}]}'
Response
1{2"url": "https://priceblocs.com/test/links/short_id",3"brand_url": "https://priceblocs.com/test/links/short_id",4"livemode": false,5"id": "00000000-0000-0000-0000-000000000000",6"object": "payment_link",7"short_id": "short_id",8"title": "My first payment link",9"description": "Each link will start a new checkout session when clicked",10"success_url": "https://priceblocs.com/checkout/success",11"cancel_url": "https://priceblocs.com/checkout/error",12"created": 1628234366,13"updated": 1628234366,14"payment_method_types": [15"card"16],17"currency": "usd",18"customer_email": "someone@gmail.com",19"customer": null,20"status": "active",21"discounts": [22{23"coupon": "coupon123"24}25],26"billing_address_collection": "auto",27"shipping_address_collection": {28"allowed_countries": [29"US"30]31},32"mode": "subscription",33"submit_type": "pay",34"allow_promotion_codes": false,35"adjustable_quantity": {36"enabled": true,37"maximum": 99,38"minimum": 139},40"shipping_worldwide": false,41"tax_rates": [42"txr_123"43],44"dynamic_tax_rates": [45"txr_456"46],47"automatic_tax": {48"enabled": true49},50"tax_id_collection": {51"enabled": false,52"type": "standard"53},54"consent_collection": {55"promotions": "auto"56},57"after_expiration": {58"recovery": {59"enabled": true,60"allow_promotion_codes": true61}62},63"expires_at": 1628234366,64"shipping_options": [65{66"shipping_rate": "shr_456"67}68],69"payment_intent_data": {70"capture_method": "automatic",71"transfer_data": {72"destination": "act_123"73}74},75"trial_period_days": null,76"trial_end": null,77"line_items": [78{79"price": "p_A_1",80"product": "p_A",81"currency": "usd",82"interval": "month",83"quantity": 1,84"dynamic_tax_rates": null,85"tax_rates": null86}87]88}