Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Visual FoxPro Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Visual FoxPro) Xero Get Invoices

Get Xero company invoices.

For more information, see https://developer.xero.com/documentation/api/invoices

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL loJsonToken
LOCAL lnSuccess
LOCAL loResp
LOCAL loJsonResponse
LOCAL lcType
LOCAL lcInvoiceID
LOCAL lcInvoiceNumber
LOCAL lcReference
LOCAL lcAmountDue
LOCAL lcAmountPaid
LOCAL lcAmountCredited
LOCAL lnIsDiscounted
LOCAL lnHasAttachments
LOCAL lnHasErrors
LOCAL lcContactContactID
LOCAL lcContactName
LOCAL lnContactHasValidationErrors
LOCAL lcDateString
LOCAL lcDate
LOCAL lcDueDateString
LOCAL lcDueDate
LOCAL lcLineAmountTypes
LOCAL lcSubTotal
LOCAL lcTotalTax
LOCAL lcTotal
LOCAL lcUpdatedDateUTC
LOCAL lcCurrencyCode
LOCAL lcFullyPaidOnDate
LOCAL lcCurrencyRate
LOCAL j
LOCAL lnCount_j
LOCAL lcPaymentID
LOCAL lcAmount
LOCAL lnHasAccount
LOCAL lnHasValidationErrors
LOCAL lcCreditNoteID
LOCAL lcCreditNoteNumber
LOCAL lcID
LOCAL lcAppliedAmount
LOCAL k
LOCAL lnCount_k
LOCAL lcId
LOCAL lcStatus
LOCAL lcProviderName
LOCAL lcDateTimeUTC
LOCAL i
LOCAL lnCount_i

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonToken = CreateObject('Chilkat.JsonObject')
lnSuccess = loJsonToken.LoadFile("qa_data/tokens/xero-access-token.json")
IF (lnSuccess = 0) THEN
    ? loJsonToken.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    CANCEL
ENDIF

loHttp.AuthToken = loJsonToken.StringOf("access_token")

* Replace the value here with an actual tenant ID obtained from this example:
* Get Xero Tenant IDs
loHttp.SetRequestHeader("Xero-tenant-id","83299b9e-5747-4a14-a18a-a6c94f824eb7")

loHttp.Accept = "application/json"

loResp = loHttp.QuickRequest("GET","https://api.xero.com/api.xro/2.0/Invoices")
IF (loHttp.LastMethodSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    CANCEL
ENDIF

? "Response Status Code: " + STR(loResp.StatusCode)

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse = CreateObject('Chilkat.JsonObject')
loJsonResponse.Load(loResp.BodyStr)
loJsonResponse.EmitCompact = 0
? loJsonResponse.Emit()

IF (loResp.StatusCode <> 200) THEN
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loJsonResponse
    CANCEL
ENDIF

RELEASE loResp

* Sample output...
* (See the parsing code below..)
* 
* Use the this online tool to generate parsing code from sample JSON: 
* Generate Parsing Code from JSON

* {
*   "Id": "bda1f62f-0d63-4178-8d54-e91fd226987a",
*   "Status": "OK",
*   "ProviderName": "Chilkat2222",
*   "DateTimeUTC": "\/Date(1587210234493)\/",
*   "Invoices": [
*     {
*       "Type": "ACCPAY",
*       "InvoiceID": "0032f627-3156-4d30-9b1c-4d3b994dc921",
*       "InvoiceNumber": "9871",
*       "Reference": "",
*       "Payments": [
*         {
*           "PaymentID": "22974891-3689-4694-9ee7-fd2ba917af55",
*           "Date": "\/Date(1579737600000+0000)\/",
*           "Amount": 148.50,
*           "Reference": "Chq 409",
*           "HasAccount": false,
*           "HasValidationErrors": false
*         }
*       ],
*       "CreditNotes": [
*       ],
*       "Prepayments": [
*       ],
*       "Overpayments": [
*       ],
*       "AmountDue": 0.00,
*       "AmountPaid": 148.50,
*       "AmountCredited": 0.00,
*       "IsDiscounted": false,
*       "HasAttachments": false,
*       "HasErrors": false,
*       "Contact": {
*         "ContactID": "d6a384fb-f46f-41a3-8ac7-b7bc9e0b5efa",
*         "Name": "Melrose Parking",
*         "Addresses": [
*         ],
*         "Phones": [
*         ],
*         "ContactGroups": [
*         ],
*         "ContactPersons": [
*         ],
*         "HasValidationErrors": false
*       },
*       "DateString": "2020-01-15T00:00:00",
*       "Date": "\/Date(1579046400000+0000)\/",
*       "DueDateString": "2020-01-24T00:00:00",
*       "DueDate": "\/Date(1579824000000+0000)\/",
*       "Status": "PAID",
*       "LineAmountTypes": "Exclusive",
*       "LineItems": [
*       ],
*       "SubTotal": 135.00,
*       "TotalTax": 13.50,
*       "Total": 148.50,
*       "UpdatedDateUTC": "\/Date(1221560931500+0000)\/",
*       "CurrencyCode": "AUD",
*       "FullyPaidOnDate": "\/Date(1579737600000+0000)\/"
*     },
*     {
*       "Type": "ACCPAY",
*       "InvoiceID": "673dd7cc-beb7-4697-83d4-0c47cb400cc2",
*       "InvoiceNumber": "",
*       "Reference": "",
*       "Payments": [
*         {
*           "PaymentID": "4d06f609-5200-4364-9c8b-d4379a945252",
*           "Date": "\/Date(1580688000000+0000)\/",
*           "Amount": 974.60,
*           "Reference": "DD # 96013",
*           "HasAccount": false,
*           "HasValidationErrors": false
*         }
*       ],
*       "CreditNotes": [
*         {
*           "CreditNoteID": "7df8949c-b71f-40c0-bbcf-39f2f450f286",
*           "CreditNoteNumber": "03391",
*           "ID": "7df8949c-b71f-40c0-bbcf-39f2f450f286",
*           "HasErrors": false,
*           "AppliedAmount": 218.90,
*           "DateString": "2020-01-29T00:00:00",
*           "Date": "\/Date(1580256000000+0000)\/",
*           "LineItems": [
*           ],
*           "Total": 218.90
*         }
*       ],
*       "Prepayments": [
*       ],
*       "Overpayments": [
*       ],
*       "AmountDue": 0.00,
*       "AmountPaid": 974.60,
*       "AmountCredited": 218.90,
*       "IsDiscounted": false,
*       "HasAttachments": false,
*       "HasErrors": false,
*       "Contact": {
*         "ContactID": "d0cd2c4f-18a0-4f7c-a32a-2db00f29d298",
*         "Name": "PC Complete",
*         "Addresses": [
*         ],
*         "Phones": [
*         ],
*         "ContactGroups": [
*         ],
*         "ContactPersons": [
*         ],
*         "HasValidationErrors": false
*       },
*       "DateString": "2020-01-28T00:00:00",
*       "Date": "\/Date(1580169600000+0000)\/",
*       "DueDateString": "2020-02-04T00:00:00",
*       "DueDate": "\/Date(1580774400000+0000)\/",
*       "Status": "PAID",
*       "LineAmountTypes": "Exclusive",
*       "LineItems": [
*       ],
*       "SubTotal": 1085.00,
*       "TotalTax": 108.50,
*       "Total": 1193.50,
*       "UpdatedDateUTC": "\/Date(1221561913790+0000)\/",
*       "CurrencyCode": "AUD",
*       "FullyPaidOnDate": "\/Date(1580688000000+0000)\/"
*     },
*     {
*       "Type": "ACCPAY",
*       "InvoiceID": "c12aff7e-12bf-4185-8702-460929f19674",
*       "InvoiceNumber": "",
*       "Reference": "",
*       "Payments": [
*       ],
*       "CreditNotes": [
*       ],
*       "Prepayments": [
*       ],
*       "Overpayments": [
*       ],
*       "AmountDue": 2166.99,
*       "AmountPaid": 0.00,
*       "AmountCredited": 0.00,
*       "CurrencyRate": 1.000000,
*       "IsDiscounted": false,
*       "HasAttachments": false,
*       "HasErrors": false,
*       "Contact": {
*         "ContactID": "d0cd2c4f-18a0-4f7c-a32a-2db00f29d298",
*         "Name": "PC Complete",
*         "Addresses": [
*         ],
*         "Phones": [
*         ],
*         "ContactGroups": [
*         ],
*         "ContactPersons": [
*         ],
*         "HasValidationErrors": false
*       },
*       "DateString": "2020-04-10T00:00:00",
*       "Date": "\/Date(1586476800000+0000)\/",
*       "DueDateString": "2020-05-05T00:00:00",
*       "DueDate": "\/Date(1588636800000+0000)\/",
*       "Status": "AUTHORISED",
*       "LineAmountTypes": "Exclusive",
*       "LineItems": [
*       ],
*       "SubTotal": 1969.99,
*       "TotalTax": 197.00,
*       "Total": 2166.99,
*       "UpdatedDateUTC": "\/Date(1497965301980+0000)\/",
*       "CurrencyCode": "AUD"
*     }
*   ]
* }
* 

lcId = loJsonResponse.StringOf("Id")
lcStatus = loJsonResponse.StringOf("Status")
lcProviderName = loJsonResponse.StringOf("ProviderName")
lcDateTimeUTC = loJsonResponse.StringOf("DateTimeUTC")
i = 0
lnCount_i = loJsonResponse.SizeOfArray("Invoices")
DO WHILE i < lnCount_i
    loJsonResponse.I = i
    lcType = loJsonResponse.StringOf("Invoices[i].Type")
    lcInvoiceID = loJsonResponse.StringOf("Invoices[i].InvoiceID")
    lcInvoiceNumber = loJsonResponse.StringOf("Invoices[i].InvoiceNumber")
    lcReference = loJsonResponse.StringOf("Invoices[i].Reference")
    lcAmountDue = loJsonResponse.StringOf("Invoices[i].AmountDue")
    lcAmountPaid = loJsonResponse.StringOf("Invoices[i].AmountPaid")
    lcAmountCredited = loJsonResponse.StringOf("Invoices[i].AmountCredited")
    lnIsDiscounted = loJsonResponse.BoolOf("Invoices[i].IsDiscounted")
    lnHasAttachments = loJsonResponse.BoolOf("Invoices[i].HasAttachments")
    lnHasErrors = loJsonResponse.BoolOf("Invoices[i].HasErrors")
    lcContactContactID = loJsonResponse.StringOf("Invoices[i].Contact.ContactID")
    lcContactName = loJsonResponse.StringOf("Invoices[i].Contact.Name")
    lnContactHasValidationErrors = loJsonResponse.BoolOf("Invoices[i].Contact.HasValidationErrors")
    lcDateString = loJsonResponse.StringOf("Invoices[i].DateString")
    lcDate = loJsonResponse.StringOf("Invoices[i].Date")
    lcDueDateString = loJsonResponse.StringOf("Invoices[i].DueDateString")
    lcDueDate = loJsonResponse.StringOf("Invoices[i].DueDate")
    lcStatus = loJsonResponse.StringOf("Invoices[i].Status")
    lcLineAmountTypes = loJsonResponse.StringOf("Invoices[i].LineAmountTypes")
    lcSubTotal = loJsonResponse.StringOf("Invoices[i].SubTotal")
    lcTotalTax = loJsonResponse.StringOf("Invoices[i].TotalTax")
    lcTotal = loJsonResponse.StringOf("Invoices[i].Total")
    lcUpdatedDateUTC = loJsonResponse.StringOf("Invoices[i].UpdatedDateUTC")
    lcCurrencyCode = loJsonResponse.StringOf("Invoices[i].CurrencyCode")
    lcFullyPaidOnDate = loJsonResponse.StringOf("Invoices[i].FullyPaidOnDate")
    lcCurrencyRate = loJsonResponse.StringOf("Invoices[i].CurrencyRate")
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Payments")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        lcPaymentID = loJsonResponse.StringOf("Invoices[i].Payments[j].PaymentID")
        lcDate = loJsonResponse.StringOf("Invoices[i].Payments[j].Date")
        lcAmount = loJsonResponse.StringOf("Invoices[i].Payments[j].Amount")
        lcReference = loJsonResponse.StringOf("Invoices[i].Payments[j].Reference")
        lnHasAccount = loJsonResponse.BoolOf("Invoices[i].Payments[j].HasAccount")
        lnHasValidationErrors = loJsonResponse.BoolOf("Invoices[i].Payments[j].HasValidationErrors")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].CreditNotes")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        lcCreditNoteID = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].CreditNoteID")
        lcCreditNoteNumber = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].CreditNoteNumber")
        lcID = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].ID")
        lnHasErrors = loJsonResponse.BoolOf("Invoices[i].CreditNotes[j].HasErrors")
        lcAppliedAmount = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].AppliedAmount")
        lcDateString = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].DateString")
        lcDate = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].Date")
        lcTotal = loJsonResponse.StringOf("Invoices[i].CreditNotes[j].Total")
        k = 0
        lnCount_k = loJsonResponse.SizeOfArray("Invoices[i].CreditNotes[j].LineItems")
        DO WHILE k < lnCount_k
            loJsonResponse.K = k
            k = k + 1
        ENDDO
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Prepayments")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Overpayments")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Contact.Addresses")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Contact.Phones")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Contact.ContactGroups")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].Contact.ContactPersons")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJsonResponse.SizeOfArray("Invoices[i].LineItems")
    DO WHILE j < lnCount_j
        loJsonResponse.J = j
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJsonToken
RELEASE loJsonResponse


 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.