Chilkat Online Tools

PowerBuilder / Marketplacer SELLER API / Remittances with Line Item Breakdown

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.BasicAuth = 1
loo_Http.Login = "{{username}}"
loo_Http.Password = "{{password}}"

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "query": "query GetRemittancesWithLineItemBreakdown(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\tlineItemAmountTotalCents\n\t\t\t\t\tlineItemTaxTotalCents\n\t\t\t\t\tcommissionAmountTotalCents\n\t\t\t\t\tcommissionTaxTotalCents\n\t\t\t\t\tremittanceAmountTotalCents\n\t\t\t\t\tremittanceTaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tamountCents\n\t\t\t\t\t\ttaxCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\tlineItemAmountCents\n\t\t\t\t\t\tlineItemTaxCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tcommissionTaxCents\n\t\t\t\t\t\tremittanceAmountCents\n\t\t\t\t\t\tremittanceTaxCents\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t\t\texternalIds {\n\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
//   "variables": "{\n\t\"pageSize\": 50,\n\t\"endCursor\": \"\",\n\t\"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"
// }

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.UpdateString("query","query GetRemittancesWithLineItemBreakdown(~n	$pageSize: Int~n	$endCursor: String~n	$createdSince: ISO8601DateTime~n) {~n	remittances(~n		first: $pageSize~n		after: $endCursor~n		createdSince: $createdSince~n	) {~n		edges {~n			node {~n				amountCents~n				#This section pulls in invoices based on their remited date~n~n				invoice {~n					id~n					legacyId~n					remittedAt~n					#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents~n					totalCents~n					commissionAmountCents~n					merchantFeeCents~n					shippingCostCents~n					taxTotalCents~n					lineItems {~n						id~n						#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents~n						totalCents~n						itemAmountCents~n						subtotalCents~n						commissionAmountCents~n						postageCents~n						taxTotalCents~n					}~n				}~n				#This section pulls in amendments based on their remited date~n				invoiceAmendment {~n					id~n					legacyId~n					remittedAt~n					totalCents~n					remittanceCents~n					lineItemAmountTotalCents~n					lineItemTaxTotalCents~n					commissionAmountTotalCents~n					commissionTaxTotalCents~n					remittanceAmountTotalCents~n					remittanceTaxTotalCents~n					lineItems {~n						amountCents~n						taxCents~n						totalCents~n						lineItemAmountCents~n						lineItemTaxCents~n						commissionAmountCents~n						commissionTaxCents~n						remittanceAmountCents~n						remittanceTaxCents~n						lineItem {~n							id~n							itemAmountCents~n							taxTotalCents~n							externalIds {~n								key~n								value~n							}~n						}~n					}~n					#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments~n					invoice {~n						legacyId~n						remittedAt~n					}~n				}~n			}~n		}~n	}~n}~n")
loo_Json.UpdateString("variables","{~n	~"pageSize~": 50,~n	~"endCursor~": ~"~",~n	~"createdSince~": ~"2022-01-22T09:30:46-08:00~"~n}")

loo_Http.SetRequestHeader("Content-Type","application/json")
loo_Http.SetRequestHeader("MARKETPLACER-API-KEY","{{api_key}}")

loo_Resp = loo_Http.PostJson3("https://bestfriendbazaar.com/graphql","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    return
end if

Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp


destroy loo_Http
destroy loo_Json

Curl Command

curl -X POST
	-u '{{username}}:{{password}}'
	-H "MARKETPLACER-API-KEY: {{api_key}}"
	-H "Content-Type: application/json"
	--data-raw '{"query":"query GetRemittancesWithLineItemBreakdown(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\tlineItemAmountTotalCents\n\t\t\t\t\tlineItemTaxTotalCents\n\t\t\t\t\tcommissionAmountTotalCents\n\t\t\t\t\tcommissionTaxTotalCents\n\t\t\t\t\tremittanceAmountTotalCents\n\t\t\t\t\tremittanceTaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tamountCents\n\t\t\t\t\t\ttaxCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\tlineItemAmountCents\n\t\t\t\t\t\tlineItemTaxCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tcommissionTaxCents\n\t\t\t\t\t\tremittanceAmountCents\n\t\t\t\t\t\tremittanceTaxCents\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t\t\texternalIds {\n\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","variables":"{\n\t\"pageSize\": 50,\n\t\"endCursor\": \"\",\n\t\"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "Remittances with Line Item Breakdown",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "MARKETPLACER-API-KEY",
        "value": "{{api_key}}",
        "type": "text"
      },
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "body": {
      "mode": "graphql",
      "graphql": {
        "query": "query GetRemittancesWithLineItemBreakdown(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\tlineItemAmountTotalCents\n\t\t\t\t\tlineItemTaxTotalCents\n\t\t\t\t\tcommissionAmountTotalCents\n\t\t\t\t\tcommissionTaxTotalCents\n\t\t\t\t\tremittanceAmountTotalCents\n\t\t\t\t\tremittanceTaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tamountCents\n\t\t\t\t\t\ttaxCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\tlineItemAmountCents\n\t\t\t\t\t\tlineItemTaxCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tcommissionTaxCents\n\t\t\t\t\t\tremittanceAmountCents\n\t\t\t\t\t\tremittanceTaxCents\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t\t\texternalIds {\n\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
        "variables": "{\n\t\"pageSize\": 50,\n\t\"endCursor\": \"\",\n\t\"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}