Creates a customer invoice object.
curl https://api.stripe.com/v1/invoices \
-u STRIPE_SECRET_KEY: \
-d customer=cus_CBbg9PmQ9sLbmo \
-X POST
LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL lcStrResponseBody
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 lnPlan
LOCAL lnProration
LOCAL lnQuantity
LOCAL lcType
loRest = CreateObject('Chilkat_9_5_0.Rest')
* URL: https://api.stripe.com/v1/invoices
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","")
loRest.AddQueryParam("customer","cus_CBbg9PmQ9sLbmo")
lcStrResponseBody = loRest.FullRequestFormUrlEncoded("POST","/v1/invoices")
IF (loRest.LastMethodSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.Load(lcStrResponseBody)
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")
lnPlan = loJsonResponse.IsNullOf("lines.data[i].plan")
lnProration = loJsonResponse.BoolOf("lines.data[i].proration")
lnQuantity = loJsonResponse.IsNullOf("lines.data[i].quantity")
lnSubscription = loJsonResponse.IsNullOf("lines.data[i].subscription")
lcType = loJsonResponse.StringOf("lines.data[i].type")
i = i + 1
ENDDO
RELEASE loRest
RELEASE loJsonResponse
{
"id": "in_1BnETLGswQrCoh0XR7p1RCtV",
"object": "invoice",
"amount_due": 0,
"application_fee": null,
"attempt_count": 0,
"attempted": false,
"billing": "charge_automatically",
"charge": null,
"closed": false,
"currency": "usd",
"customer": "cus_CBbg9PmQ9sLbmo",
"date": 1516662783,
"description": null,
"discount": null,
"due_date": null,
"ending_balance": null,
"forgiven": false,
"lines": {
"data": [
{
"id": "ii_1BnETLGswQrCoh0XsAcSzoLf",
"object": "line_item",
"amount": 0,
"currency": "usd",
"description": "My First Invoice Item (created for API docs)",
"discountable": true,
"livemode": false,
"metadata": {},
"period": {
"start": 1516662783,
"end": 1516662783
},
"plan": null,
"proration": false,
"quantity": null,
"subscription": null,
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices/in_1BnETLGswQrCoh0XR7p1RCtV/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": 1516666383,
"number": "36eba31eaa-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
}