This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Invoices in TradeGecko

The createInvoice operation creates a new invoice.

createInvoice
<tradegecko.createInvoice>
 	<orderId>{$ctx:orderId}</orderId>
	<billingAddressId>{$ctx:billingAddressId}</billingAddressId>
	<shippingAddressId>{$ctx:shippingAddressId}</shippingAddressId>
	<paymentTermId>{$ctx:paymentTermId}</paymentTermId>
	<invoicedAt>{$ctx:invoicedAt}</invoicedAt>
	<dueAt>{$ctx:dueAt}</dueAt>
    <notes>{$ctx:notes}</notes>
	<invoiceLineItems>{$ctx:invoiceLineItems}</invoiceLineItems>
</tradegecko.createInvoice>
Properties
  • orderId: The unique order ID for the invoice.
  • billingAddressId: The unique billing address ID for the invoice.
  • shippingAddressId: The unique shipping address ID for the invoice.
  • paymentTermId: The unique payment term ID for the invoice.
  • invoicedAt: The begin date of the invoice.
  • dueAt: The end date of the invoice.
  • notes: Special notes for the invoice.
  • invoiceLineItems: Separate invoice line items.
Sample request

Following is a sample REST/JSON request that can be handled by the createInvoice operation.

Sample Request for createInvoice
{
	"apiUrl":"https://api.tradegecko.com",
	"accessToken":"d22f765b70930a085b7bdd6bb441569706608061042c52c9e39a856a340f7365",
	"orderId":"2097851",
	"billingAddressId":"17010",
	"shippingAddressId":"17011",
	"paymentTermId":"17001",
	"invoicedAt":"2014-10-18",
	"dueAt":"2014-10-28",
	"notes":"Special note for invoice.",
	"invoiceLineItems":[
        { 
          "quantity":"0.6",
          "order_line_item_id":"2361192"
        },
        { 
          "quantity":"1.5",
          "order_line_item_id":"2361193"
        }
    ]
}
Related TradeGecko documentation

http://developer.tradegecko.com/api/invoice/

Sample configuration

Following is a sample proxy service that illustrates how to connect to TradeGecko with the init operation and use the createInvoice operation. The sample request for this proxy can be found in createInvoice sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tradegecko_createInvoice"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="orderId" expression="json-eval($.orderId)"/>
         <property name="billingAddressId" expression="json-eval($.billingAddressId)"/>
         <property name="shippingAddressId" expression="json-eval($.shippingAddressId)"/>
         <property name="paymentTermId" expression="json-eval($.paymentTermId)"/>
         <property name="invoicedAt" expression="json-eval($.invoicedAt)"/>
         <property name="dueAt" expression="json-eval($.dueAt)"/>
         <property name="notes" expression="json-eval($.notes)"/>
         <property name="invoiceLineItems" expression="json-eval($.invoiceLineItems)"/>
         <tradegecko.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </tradegecko.init>
         <tradegecko.createInvoice>
            <orderId>{$ctx:orderId}</orderId>
            <billingAddressId>{$ctx:billingAddressId}</billingAddressId>
            <shippingAddressId>{$ctx:shippingAddressId}</shippingAddressId>
            <paymentTermId>{$ctx:paymentTermId}</paymentTermId>
            <invoicedAt>{$ctx:invoicedAt}</invoicedAt>
            <dueAt>{$ctx:dueAt}</dueAt>
            <notes>{$ctx:notes}</notes>
            <invoiceLineItems>{$ctx:invoiceLineItems}</invoiceLineItems>
         </tradegecko.createInvoice>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>