Xbase++ Requires Chilkat v11.7.0+
Xbase++
Stripe: Retire a payment link
See more Stripe Examples
Deactivate a saved Payment Link. Existing subscriptions created through that link keep their own lifecycle.
Stripe documentation and cURL example
Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL cApiKey
LOCAL cOperationId
LOCAL oCurl
LOCAL oCmd
LOCAL oJson
LOCAL nReplaced
LOCAL cLinkId
nSuccess := 0
// Requires an unlocked Chilkat bundle. See Global Unlock Sample.
// Supply a restricted sandbox key from merchant-controlled configuration.
cApiKey := "YOUR_STRIPE_TEST_KEY"
// Load the saved UUID for this operation. Reuse it only for a retry with identical inputs.
cOperationId := "YOUR_SAVED_OPERATION_UUID"
oCurl := CreateObject("Chilkat.HttpCurl")
oCmd := CreateObject("Chilkat.StringBuilder")
oJson := CreateObject("Chilkat.JsonObject")
cLinkId := "plink_FROM_SAVED_LINK"
// curl -X POST "https://api.stripe.com/v1/payment_links/{linkId}" \
// -u "$STRIPE_API_KEY:" \
// -H "Stripe-Version: 2026-10-28.endive" \
// -H "Idempotency-Key: {operationId}-deactivate" \
// -d "active=false"
oCmd:SetString('curl -X POST "https://api.stripe.com/v1/payment_links/@ID@"')
oCmd:Append(' -u "@KEY@:"')
oCmd:Append(' -H "Stripe-Version: 2026-10-28.endive"')
oCmd:Append(' -H "Idempotency-Key: @OP@-deactivate"')
oCmd:Append(' -d "active=false"')
nReplaced := oCmd:Replace("@ID@", cLinkId)
nReplaced := oCmd:Replace("@OP@", cOperationId)
nReplaced := oCmd:Replace("@KEY@", cApiKey)
nSuccess := oCurl:DoYourThing(oCmd:GetAsString())
IF (nSuccess != 1)
? "No HTTP response. Chilkat failure code: " + Str(oCurl:FailReason)
oCurl:destroy()
oCmd:destroy()
oJson:destroy()
RETURN
ENDIF
nSuccess := oCurl:GetResponseJson(oJson)
IF ((oCurl:StatusCode != 200) .OR. (nSuccess != 1))
? "Stripe HTTP " + Str(oCurl:StatusCode) + " Request-Id: " + oCurl:GetResponseHeaderField("Request-Id")
IF (nSuccess == 1)
? oJson:StringOf("error.message")
ENDIF
oCurl:destroy()
oCmd:destroy()
oJson:destroy()
RETURN
ENDIF
? "id = " + oJson:StringOf("id")
? "url = " + oJson:StringOf("url")
? "Link active: " + Str(oJson:BoolOf("active"))
// Existing subscriptions continue until managed separately.
oCurl:destroy()
oCmd:destroy()
oJson:destroy()