Tcl Requires Chilkat v11.7.0+
Tcl
Stripe: Create a shareable payment URL
See more Stripe Examples
Create a shareable payment URL from a catalog price. The price determines whether the link sells a one-time purchase or a subscription.
Stripe documentation and cURL example
Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# Requires an unlocked Chilkat bundle. See Global Unlock Sample.
# Supply a restricted sandbox key from merchant-controlled configuration.
set apiKey "YOUR_STRIPE_TEST_KEY"
# Load the saved UUID for this operation. Reuse it only for a retry with identical inputs.
set operationId "YOUR_SAVED_OPERATION_UUID"
set curl [new_CkHttpCurl]
set cmd [new_CkStringBuilder]
set json [new_CkJsonObject]
set priceId "price_FROM_CATALOG"
# Choose a one-time price for a purchase or a recurring price for a subscription link.
# curl -X POST "https://api.stripe.com/v1/payment_links" \
# -u "$STRIPE_API_KEY:" \
# -H "Stripe-Version: 2026-10-28.endive" \
# -H "Idempotency-Key: {operationId}-link" \
# -d "line_items[0][price]={priceId}" \
# -d "line_items[0][quantity]=1"
CkStringBuilder_SetString $cmd "curl -X POST \"https://api.stripe.com/v1/payment_links\""
CkStringBuilder_Append $cmd " -u \"@KEY@:\""
CkStringBuilder_Append $cmd " -H \"Stripe-Version: 2026-10-28.endive\""
CkStringBuilder_Append $cmd " -H \"Idempotency-Key: @OP@-link\""
CkStringBuilder_Append $cmd " -d \"line_items[0][price]=@PRICE@\""
CkStringBuilder_Append $cmd " -d \"line_items[0][quantity]=1\""
set replaced [CkStringBuilder_Replace $cmd "@PRICE@" $priceId]
set replaced [CkStringBuilder_Replace $cmd "@OP@" $operationId]
set replaced [CkStringBuilder_Replace $cmd "@KEY@" $apiKey]
set success [CkHttpCurl_DoYourThing $curl [CkStringBuilder_getAsString $cmd]]
if {$success != 1} then {
puts "No HTTP response. Chilkat failure code: [CkHttpCurl_get_FailReason $curl]"
delete_CkHttpCurl $curl
delete_CkStringBuilder $cmd
delete_CkJsonObject $json
exit
}
set success [CkHttpCurl_GetResponseJson $curl $json]
if {expr [[CkHttpCurl_get_StatusCode $curl] != 200] || [$success != 1]} then {
puts "Stripe HTTP [CkHttpCurl_get_StatusCode $curl] Request-Id: [CkHttpCurl_getResponseHeaderField $curl Request-Id]"
if {$success == 1} then {
puts [CkJsonObject_stringOf $json error.message]
}
delete_CkHttpCurl $curl
delete_CkStringBuilder $cmd
delete_CkJsonObject $json
exit
}
puts "id = [CkJsonObject_stringOf $json id]"
puts "url = [CkJsonObject_stringOf $json url]"
# Save the link ID for management. Share the hosted URL with customers.
delete_CkHttpCurl $curl
delete_CkStringBuilder $cmd
delete_CkJsonObject $json