Creates a customer invoice object.
curl https://api.stripe.com/v1/invoices \
-u STRIPE_SECRET_KEY: \
-d customer=cus_CBbg9PmQ9sLbmo \
-X POST
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Boolean iBTls
Integer iPort
Boolean iBAutoReconnect
String sStrResponseBody
Handle hoJsonResponse
String sId
String sObject
Integer iAmount_due
Boolean iApplication_fee
Integer iAttempt_count
Boolean iAttempted
String sBilling
Boolean iCharge
Boolean iClosed
String sCurrency
String sCustomer
Integer iDate
Boolean iDescription
Boolean iDiscount
Boolean iDue_date
Boolean iEnding_balance
Boolean iForgiven
Boolean iLinesHas_more
String sLinesObject
String sLinesUrl
Boolean iLivemode
Integer iNext_payment_attempt
String sNumber
Boolean iPaid
Integer iPeriod_end
Integer iPeriod_start
Boolean iReceipt_number
Integer iStarting_balance
Boolean iStatement_descriptor
Boolean iSubscription
Integer iSubtotal
Boolean iTax
Boolean iTax_percent
Integer iTotal
Boolean iWebhooks_delivered_at
Integer i
Integer iCount_i
Integer iAmount
String sDescription_str
Boolean iDiscountable
Integer iPeriodStart
Integer iPeriodEnd
Boolean iPlan
Boolean iProration
Boolean iQuantity
String sType
String sTemp1
Integer iTemp1
Boolean bTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// URL: https://api.stripe.com/v1/invoices
Move True To iBTls
Move 443 To iPort
Move True To iBAutoReconnect
Get ComConnect Of hoRest "api.stripe.com" iPort iBTls iBAutoReconnect To iSuccess
If (iSuccess <> True) Begin
Get ComConnectFailReason Of hoRest To iTemp1
Showln "ConnectFailReason: " iTemp1
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComSetAuthBasic Of hoRest "STRIPE_SECRET_KEY" "" To iSuccess
Get ComAddQueryParam Of hoRest "customer" "cus_CBbg9PmQ9sLbmo" To iSuccess
Get ComFullRequestFormUrlEncoded Of hoRest "POST" "/v1/invoices" To sStrResponseBody
Get ComLastMethodSuccess Of hoRest To bTemp1
If (bTemp1 <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get ComLoad Of hoJsonResponse sStrResponseBody To iSuccess
Get ComStringOf Of hoJsonResponse "id" To sId
Get ComStringOf Of hoJsonResponse "object" To sObject
Get ComIntOf Of hoJsonResponse "amount_due" To iAmount_due
Get ComIsNullOf Of hoJsonResponse "application_fee" To iApplication_fee
Get ComIntOf Of hoJsonResponse "attempt_count" To iAttempt_count
Get ComBoolOf Of hoJsonResponse "attempted" To iAttempted
Get ComStringOf Of hoJsonResponse "billing" To sBilling
Get ComIsNullOf Of hoJsonResponse "charge" To iCharge
Get ComBoolOf Of hoJsonResponse "closed" To iClosed
Get ComStringOf Of hoJsonResponse "currency" To sCurrency
Get ComStringOf Of hoJsonResponse "customer" To sCustomer
Get ComIntOf Of hoJsonResponse "date" To iDate
Get ComIsNullOf Of hoJsonResponse "description" To iDescription
Get ComIsNullOf Of hoJsonResponse "discount" To iDiscount
Get ComIsNullOf Of hoJsonResponse "due_date" To iDue_date
Get ComIsNullOf Of hoJsonResponse "ending_balance" To iEnding_balance
Get ComBoolOf Of hoJsonResponse "forgiven" To iForgiven
Get ComBoolOf Of hoJsonResponse "lines.has_more" To iLinesHas_more
Get ComStringOf Of hoJsonResponse "lines.object" To sLinesObject
Get ComStringOf Of hoJsonResponse "lines.url" To sLinesUrl
Get ComBoolOf Of hoJsonResponse "livemode" To iLivemode
Get ComIntOf Of hoJsonResponse "next_payment_attempt" To iNext_payment_attempt
Get ComStringOf Of hoJsonResponse "number" To sNumber
Get ComBoolOf Of hoJsonResponse "paid" To iPaid
Get ComIntOf Of hoJsonResponse "period_end" To iPeriod_end
Get ComIntOf Of hoJsonResponse "period_start" To iPeriod_start
Get ComIsNullOf Of hoJsonResponse "receipt_number" To iReceipt_number
Get ComIntOf Of hoJsonResponse "starting_balance" To iStarting_balance
Get ComIsNullOf Of hoJsonResponse "statement_descriptor" To iStatement_descriptor
Get ComIsNullOf Of hoJsonResponse "subscription" To iSubscription
Get ComIntOf Of hoJsonResponse "subtotal" To iSubtotal
Get ComIsNullOf Of hoJsonResponse "tax" To iTax
Get ComIsNullOf Of hoJsonResponse "tax_percent" To iTax_percent
Get ComIntOf Of hoJsonResponse "total" To iTotal
Get ComIsNullOf Of hoJsonResponse "webhooks_delivered_at" To iWebhooks_delivered_at
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "lines.data" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "lines.data[i].id" To sId
Get ComStringOf Of hoJsonResponse "lines.data[i].object" To sObject
Get ComIntOf Of hoJsonResponse "lines.data[i].amount" To iAmount
Get ComStringOf Of hoJsonResponse "lines.data[i].currency" To sCurrency
Get ComStringOf Of hoJsonResponse "lines.data[i].description" To sDescription_str
Get ComBoolOf Of hoJsonResponse "lines.data[i].discountable" To iDiscountable
Get ComBoolOf Of hoJsonResponse "lines.data[i].livemode" To iLivemode
Get ComIntOf Of hoJsonResponse "lines.data[i].period.start" To iPeriodStart
Get ComIntOf Of hoJsonResponse "lines.data[i].period.end" To iPeriodEnd
Get ComIsNullOf Of hoJsonResponse "lines.data[i].plan" To iPlan
Get ComBoolOf Of hoJsonResponse "lines.data[i].proration" To iProration
Get ComIsNullOf Of hoJsonResponse "lines.data[i].quantity" To iQuantity
Get ComIsNullOf Of hoJsonResponse "lines.data[i].subscription" To iSubscription
Get ComStringOf Of hoJsonResponse "lines.data[i].type" To sType
Move i + 1 To i
Loop
End_Procedure
{
"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
}