Ordercompleted data has some fields that conflict with other fields

I have just run a transaction in Test mode and am looking at the data returned in the ordercompleted webhook. There are inconsistencies in the data between the top level “order” values, the values inside the “item” and the “summary” values.

The transaction has a single item. It has been sold in Australia, which means that a tax of 10% has been applied to it, and is included in the price. In the “Add to Cart Button” this is expressed as:

button etc etc...
  data-item-taxable="true"
  data-item-tax-rate="0.1"
  data-item-taxes="GST"
  data-item-has-taxes-included="true"
  data-item-price="{"usd":"1,500.00","aud":"1,650.00"}"

These are the relevant/confusing elements from the returned data.

At the top level:

  "adjustedAmount": 1650.0,
  "finalGrandTotal": 1650.0,
  "totalNumberOfItems": 0,
  "subtotal": 1650.0,
  "baseTotal": 1650.0,
  "itemsTotal": 1650.0,
  "totalPriceWithoutDiscountsAndTaxes": 1500.0,
  "taxableTotal": 1650.0,
  "grandTotal": 1650.0,
  "total": 1650.0,
  "taxesTotal": 0.0,
  "itemsCount": 1

The itemsCount is correct, but not the TotalNumberOfItems, the taxableTotal and taxesTotal are also wrong.

This the taxes item - and the values are correct. Hooray

"taxes": [
    {
      "taxName": "GST",
      "taxRate": 0.1,
      "amount": 150.0,
      "numberForInvoice": "REDACTED",
      "includedInPrice": true,
      "appliesOnShipping": false,
      "discountInducedAmountVariation": 0.0
    }
  ],

This is the summary:

 "summary": {
    "subtotal": 1650.0,
    "taxableTotal": 1650.0,
    "total": 1650.0,
    "taxes": [
      {
        "taxId": null,
        "name": "GST",
        "rate": 0.1,
        "amount": 150.0,
        "unroundedAmount": 150.0,
        "numberForInvoice": "REDACTED,
        "includedInPrice": false,
      }
    ],

I am particularly concerned that the summary values for subtotal and taxableTotal are wrong, as are summary.taxes.includedInPrice .

To extract a “true” summary of the transaction I have to pick and choose between competing values. Is there a guide to the specific meaning of some of fields?

thanks very much, Anita

@Anita This would need a fix so the top level and summary would show correct information and for which I’ve sent a request to our dev team, however, there is no ETA on when it will be fixed. As for now, you can use totalPriceWithoutDiscountsAndTaxes from the top-level, tax amount from the tax item, and subtotal from the summary for your use.

Thanks for letting me know that this has been forwarded to development.

Anita