Visual FoxPro Requires Chilkat v11.7.0+
Visual FoxPro
Stripe: Review invoices and outstanding amounts
See more Stripe Examples
List open invoices for a billing account and show outstanding amounts, due dates, and invoice links.
Stripe documentation and cURL example
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL lcApiKey
LOCAL loCurl
LOCAL loCmd
LOCAL loJson
LOCAL lnReplaced
LOCAL lcCustomerId
LOCAL loPageSuffix
LOCAL lnMore
LOCAL lcCursor
LOCAL i
LOCAL lnCount
LOCAL lcNext
lnSuccess = 0
* Requires an unlocked Chilkat bundle. See Global Unlock Sample.
* Supply a restricted sandbox key from merchant-controlled configuration.
lcApiKey = "YOUR_STRIPE_TEST_KEY"
loCurl = CreateObject('Chilkat.HttpCurl')
loCmd = CreateObject('Chilkat.StringBuilder')
loJson = CreateObject('Chilkat.JsonObject')
lcCustomerId = "cus_FROM_BILLING_ACCOUNT"
* Remove status=open to show all invoice states.
loPageSuffix = CreateObject('Chilkat.StringBuilder')
lnMore = 1
lcCursor = ""
DO WHILE (lnMore = 1)
* curl -X GET "https://api.stripe.com/v1/invoices?customer={customerId}&status=open&limit=100" \
* -u "$STRIPE_API_KEY:" \
* -H "Stripe-Version: 2026-10-28.endive"
loCmd.SetString('curl -X GET "https://api.stripe.com/v1/invoices?customer=@CUSTOMER@&status=open&limit=100@CURSOR@"')
loCmd.Append(' -u "@KEY@:"')
loCmd.Append(' -H "Stripe-Version: 2026-10-28.endive"')
lnReplaced = loCmd.Replace("@CURSOR@",loPageSuffix.GetAsString())
lnReplaced = loCmd.Replace("@CUSTOMER@",lcCustomerId)
lnReplaced = loCmd.Replace("@KEY@",lcApiKey)
lnSuccess = loCurl.DoYourThing(loCmd.GetAsString())
IF (lnSuccess <> 1) THEN
? "No HTTP response. Chilkat failure code: " + STR(loCurl.FailReason)
RELEASE loCurl
RELEASE loCmd
RELEASE loJson
RELEASE loPageSuffix
CANCEL
ENDIF
lnSuccess = loCurl.GetResponseJson(loJson)
IF ((loCurl.StatusCode <> 200) OR (lnSuccess <> 1)) THEN
? "Stripe HTTP " + STR(loCurl.StatusCode) + " Request-Id: " + loCurl.GetResponseHeaderField("Request-Id")
IF (lnSuccess = 1) THEN
? loJson.StringOf("error.message")
ENDIF
RELEASE loCurl
RELEASE loCmd
RELEASE loJson
RELEASE loPageSuffix
CANCEL
ENDIF
i = 0
lnCount = loJson.SizeOfArray("data")
DO WHILE (i < lnCount)
loJson.I = i
? loJson.StringOf("data[i].id") + " | " + loJson.StringOf("data[i].number") + " | " + loJson.StringOf("data[i].status") + " | " + loJson.StringOf("data[i].due_date") + " | " + loJson.StringOf("data[i].amount_remaining") + " | " + loJson.StringOf("data[i].currency") + " | " + loJson.StringOf("data[i].hosted_invoice_url") + " | " + loJson.StringOf("data[i].invoice_pdf")
i = i + 1
ENDDO
lnMore = loJson.BoolOf("has_more")
IF (lnMore = 1) THEN
lcNext = loJson.StringOf("data[i].id")
IF ((lnCount < 1) OR (lcNext = "") OR (lcNext = lcCursor)) THEN
? "Invalid pagination cursor."
RELEASE loCurl
RELEASE loCmd
RELEASE loJson
RELEASE loPageSuffix
CANCEL
ENDIF
lcCursor = lcNext
loPageSuffix.SetString("&starting_after=")
loPageSuffix.Append(lcCursor)
ENDIF
ENDDO
RELEASE loCurl
RELEASE loCmd
RELEASE loJson
RELEASE loPageSuffix