Creates a customer invoice object.
curl https://api.stripe.com/v1/invoices \
-u STRIPE_SECRET_KEY: \
-d customer=cus_CBbg9PmQ9sLbmo \
-X POST
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
string ls_StrResponseBody
oleobject loo_JsonResponse
string ls_Id
string ls_Object
integer li_Amount_due
integer li_Application_fee
integer li_Attempt_count
integer li_Attempted
string ls_Billing
integer li_Charge
integer li_Closed
string ls_Currency
string ls_Customer
integer li_Date
integer li_Description
integer li_Discount
integer li_Due_date
integer li_Ending_balance
integer li_Forgiven
integer li_LinesHas_more
string ls_LinesObject
string ls_LinesUrl
integer li_Livemode
integer li_Next_payment_attempt
string ls_Number
integer li_Paid
integer li_Period_end
integer li_Period_start
integer li_Receipt_number
integer li_Starting_balance
integer li_Statement_descriptor
integer li_Subscription
integer li_Subtotal
integer li_Tax
integer li_Tax_percent
integer li_Total
integer li_Webhooks_delivered_at
integer i
integer li_Count_i
integer li_Amount
string ls_Description_str
integer li_Discountable
integer li_PeriodStart
integer li_PeriodEnd
integer li_Plan
integer li_Proration
integer li_Quantity
string ls_Type
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://api.stripe.com/v1/invoices
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.stripe.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Rest.SetAuthBasic("STRIPE_SECRET_KEY","")
loo_Rest.AddQueryParam("customer","cus_CBbg9PmQ9sLbmo")
ls_StrResponseBody = loo_Rest.FullRequestFormUrlEncoded("POST","/v1/invoices")
if loo_Rest.LastMethodSuccess <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.Load(ls_StrResponseBody)
ls_Id = loo_JsonResponse.StringOf("id")
ls_Object = loo_JsonResponse.StringOf("object")
li_Amount_due = loo_JsonResponse.IntOf("amount_due")
li_Application_fee = loo_JsonResponse.IsNullOf("application_fee")
li_Attempt_count = loo_JsonResponse.IntOf("attempt_count")
li_Attempted = loo_JsonResponse.BoolOf("attempted")
ls_Billing = loo_JsonResponse.StringOf("billing")
li_Charge = loo_JsonResponse.IsNullOf("charge")
li_Closed = loo_JsonResponse.BoolOf("closed")
ls_Currency = loo_JsonResponse.StringOf("currency")
ls_Customer = loo_JsonResponse.StringOf("customer")
li_Date = loo_JsonResponse.IntOf("date")
li_Description = loo_JsonResponse.IsNullOf("description")
li_Discount = loo_JsonResponse.IsNullOf("discount")
li_Due_date = loo_JsonResponse.IsNullOf("due_date")
li_Ending_balance = loo_JsonResponse.IsNullOf("ending_balance")
li_Forgiven = loo_JsonResponse.BoolOf("forgiven")
li_LinesHas_more = loo_JsonResponse.BoolOf("lines.has_more")
ls_LinesObject = loo_JsonResponse.StringOf("lines.object")
ls_LinesUrl = loo_JsonResponse.StringOf("lines.url")
li_Livemode = loo_JsonResponse.BoolOf("livemode")
li_Next_payment_attempt = loo_JsonResponse.IntOf("next_payment_attempt")
ls_Number = loo_JsonResponse.StringOf("number")
li_Paid = loo_JsonResponse.BoolOf("paid")
li_Period_end = loo_JsonResponse.IntOf("period_end")
li_Period_start = loo_JsonResponse.IntOf("period_start")
li_Receipt_number = loo_JsonResponse.IsNullOf("receipt_number")
li_Starting_balance = loo_JsonResponse.IntOf("starting_balance")
li_Statement_descriptor = loo_JsonResponse.IsNullOf("statement_descriptor")
li_Subscription = loo_JsonResponse.IsNullOf("subscription")
li_Subtotal = loo_JsonResponse.IntOf("subtotal")
li_Tax = loo_JsonResponse.IsNullOf("tax")
li_Tax_percent = loo_JsonResponse.IsNullOf("tax_percent")
li_Total = loo_JsonResponse.IntOf("total")
li_Webhooks_delivered_at = loo_JsonResponse.IsNullOf("webhooks_delivered_at")
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("lines.data")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_Id = loo_JsonResponse.StringOf("lines.data[i].id")
ls_Object = loo_JsonResponse.StringOf("lines.data[i].object")
li_Amount = loo_JsonResponse.IntOf("lines.data[i].amount")
ls_Currency = loo_JsonResponse.StringOf("lines.data[i].currency")
ls_Description_str = loo_JsonResponse.StringOf("lines.data[i].description")
li_Discountable = loo_JsonResponse.BoolOf("lines.data[i].discountable")
li_Livemode = loo_JsonResponse.BoolOf("lines.data[i].livemode")
li_PeriodStart = loo_JsonResponse.IntOf("lines.data[i].period.start")
li_PeriodEnd = loo_JsonResponse.IntOf("lines.data[i].period.end")
li_Plan = loo_JsonResponse.IsNullOf("lines.data[i].plan")
li_Proration = loo_JsonResponse.BoolOf("lines.data[i].proration")
li_Quantity = loo_JsonResponse.IsNullOf("lines.data[i].quantity")
li_Subscription = loo_JsonResponse.IsNullOf("lines.data[i].subscription")
ls_Type = loo_JsonResponse.StringOf("lines.data[i].type")
i = i + 1
loop
destroy loo_Rest
destroy loo_JsonResponse
{
"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
}