Retrieves an upcoming invoice.
curl https://api.stripe.com/v1/invoices/upcoming?customer=cus_CBbggkUyLoz3pe \
-u STRIPE_SECRET_KEY:
LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL loSbResponseBody
LOCAL loJsonResponse
LOCAL lcId
LOCAL lcObject
LOCAL lnAmount_due
LOCAL lnApplication_fee
LOCAL lnAttempt_count
LOCAL lnAttempted
LOCAL lcBilling
LOCAL lnCharge
LOCAL lnClosed
LOCAL lcCurrency
LOCAL lcCustomer
LOCAL lnDate
LOCAL lnDescription
LOCAL lnDiscount
LOCAL lnDue_date
LOCAL lnEnding_balance
LOCAL lnForgiven
LOCAL lnLinesHas_more
LOCAL lcLinesObject
LOCAL lcLinesUrl
LOCAL lnLivemode
LOCAL lnNext_payment_attempt
LOCAL lcNumber
LOCAL lnPaid
LOCAL lnPeriod_end
LOCAL lnPeriod_start
LOCAL lnReceipt_number
LOCAL lnStarting_balance
LOCAL lnStatement_descriptor
LOCAL lnSubscription
LOCAL lnSubtotal
LOCAL lnTax
LOCAL lnTax_percent
LOCAL lnTotal
LOCAL lnWebhooks_delivered_at
LOCAL i
LOCAL lnCount_i
LOCAL lnAmount
LOCAL lcDescription_str
LOCAL lnDiscountable
LOCAL lnPeriodStart
LOCAL lnPeriodEnd
LOCAL lcPlanId
LOCAL lcPlanObject
LOCAL lnPlanAmount
LOCAL lnPlanCreated
LOCAL lcPlanCurrency
LOCAL lcPlanInterval
LOCAL lnPlanInterval_count
LOCAL lnPlanLivemode
LOCAL lcPlanName
LOCAL lnPlanStatement_descriptor
LOCAL lnPlanTrial_period_days
LOCAL lnProration
LOCAL lnQuantity
LOCAL lcSubscription_item
LOCAL lcType
loRest = CreateObject('Chilkat_9_5_0.Rest')
* URL: https://api.stripe.com/v1/invoices/upcoming?customer=cus_CBbggkUyLoz3pe
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("api.stripe.com",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
loRest.SetAuthBasic("STRIPE_SECRET_KEY","")
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/v1/invoices/upcoming?customer=cus_CBbggkUyLoz3pe",loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loSbResponseBody
CANCEL
ENDIF
loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.LoadSb(loSbResponseBody)
lcId = loJsonResponse.StringOf("id")
lcObject = loJsonResponse.StringOf("object")
lnAmount_due = loJsonResponse.IntOf("amount_due")
lnApplication_fee = loJsonResponse.IsNullOf("application_fee")
lnAttempt_count = loJsonResponse.IntOf("attempt_count")
lnAttempted = loJsonResponse.BoolOf("attempted")
lcBilling = loJsonResponse.StringOf("billing")
lnCharge = loJsonResponse.IsNullOf("charge")
lnClosed = loJsonResponse.BoolOf("closed")
lcCurrency = loJsonResponse.StringOf("currency")
lcCustomer = loJsonResponse.StringOf("customer")
lnDate = loJsonResponse.IntOf("date")
lnDescription = loJsonResponse.IsNullOf("description")
lnDiscount = loJsonResponse.IsNullOf("discount")
lnDue_date = loJsonResponse.IsNullOf("due_date")
lnEnding_balance = loJsonResponse.IsNullOf("ending_balance")
lnForgiven = loJsonResponse.BoolOf("forgiven")
lnLinesHas_more = loJsonResponse.BoolOf("lines.has_more")
lcLinesObject = loJsonResponse.StringOf("lines.object")
lcLinesUrl = loJsonResponse.StringOf("lines.url")
lnLivemode = loJsonResponse.BoolOf("livemode")
lnNext_payment_attempt = loJsonResponse.IntOf("next_payment_attempt")
lcNumber = loJsonResponse.StringOf("number")
lnPaid = loJsonResponse.BoolOf("paid")
lnPeriod_end = loJsonResponse.IntOf("period_end")
lnPeriod_start = loJsonResponse.IntOf("period_start")
lnReceipt_number = loJsonResponse.IsNullOf("receipt_number")
lnStarting_balance = loJsonResponse.IntOf("starting_balance")
lnStatement_descriptor = loJsonResponse.IsNullOf("statement_descriptor")
lnSubscription = loJsonResponse.IsNullOf("subscription")
lnSubtotal = loJsonResponse.IntOf("subtotal")
lnTax = loJsonResponse.IsNullOf("tax")
lnTax_percent = loJsonResponse.IsNullOf("tax_percent")
lnTotal = loJsonResponse.IntOf("total")
lnWebhooks_delivered_at = loJsonResponse.IsNullOf("webhooks_delivered_at")
i = 0
lnCount_i = loJsonResponse.SizeOfArray("lines.data")
DO WHILE i < lnCount_i
loJsonResponse.I = i
lcId = loJsonResponse.StringOf("lines.data[i].id")
lcObject = loJsonResponse.StringOf("lines.data[i].object")
lnAmount = loJsonResponse.IntOf("lines.data[i].amount")
lcCurrency = loJsonResponse.StringOf("lines.data[i].currency")
lcDescription_str = loJsonResponse.StringOf("lines.data[i].description")
lnDiscountable = loJsonResponse.BoolOf("lines.data[i].discountable")
lnLivemode = loJsonResponse.BoolOf("lines.data[i].livemode")
lnPeriodStart = loJsonResponse.IntOf("lines.data[i].period.start")
lnPeriodEnd = loJsonResponse.IntOf("lines.data[i].period.end")
lcPlanId = loJsonResponse.StringOf("lines.data[i].plan.id")
lcPlanObject = loJsonResponse.StringOf("lines.data[i].plan.object")
lnPlanAmount = loJsonResponse.IntOf("lines.data[i].plan.amount")
lnPlanCreated = loJsonResponse.IntOf("lines.data[i].plan.created")
lcPlanCurrency = loJsonResponse.StringOf("lines.data[i].plan.currency")
lcPlanInterval = loJsonResponse.StringOf("lines.data[i].plan.interval")
lnPlanInterval_count = loJsonResponse.IntOf("lines.data[i].plan.interval_count")
lnPlanLivemode = loJsonResponse.BoolOf("lines.data[i].plan.livemode")
lcPlanName = loJsonResponse.StringOf("lines.data[i].plan.name")
lnPlanStatement_descriptor = loJsonResponse.IsNullOf("lines.data[i].plan.statement_descriptor")
lnPlanTrial_period_days = loJsonResponse.IsNullOf("lines.data[i].plan.trial_period_days")
lnProration = loJsonResponse.BoolOf("lines.data[i].proration")
lnQuantity = loJsonResponse.IntOf("lines.data[i].quantity")
lnSubscription = loJsonResponse.IsNullOf("lines.data[i].subscription")
lcSubscription_item = loJsonResponse.StringOf("lines.data[i].subscription_item")
lcType = loJsonResponse.StringOf("lines.data[i].type")
i = i + 1
ENDDO
RELEASE loRest
RELEASE loSbResponseBody
RELEASE loJsonResponse
{
"id": "in_1BnETLGswQrCoh0X6M67Qy9c",
"object": "invoice",
"amount_due": 0,
"application_fee": null,
"attempt_count": 0,
"attempted": false,
"billing": "charge_automatically",
"charge": null,
"closed": false,
"currency": "usd",
"customer": "cus_CBbggkUyLoz3pe",
"date": 1516662783,
"description": null,
"discount": null,
"due_date": null,
"ending_balance": null,
"forgiven": false,
"lines": {
"data": [
{
"id": "sub_CBbgC3EaFZqN3Q",
"object": "line_item",
"amount": 999,
"currency": "usd",
"description": "1x Silver Express (at $9.99)",
"discountable": true,
"livemode": true,
"metadata": {},
"period": {
"start": 1521760383,
"end": 1524438783
},
"plan": {
"id": "gold",
"object": "plan",
"amount": 2000,
"created": 1516662783,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"name": "T-shirt",
"statement_descriptor": null,
"trial_period_days": null
},
"proration": false,
"quantity": 1,
"subscription": null,
"subscription_item": "si_CBbgZxCVF3Ha7P",
"type": "subscription"
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices/in_1BnETLGswQrCoh0X6M67Qy9c/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": 1516666383,
"number": "330a34b8d5-0001",
"paid": false,
"period_end": 1516662783,
"period_start": 1516662783,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"subscription": null,
"subtotal": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"webhooks_delivered_at": null
}