delphiDll / Marketplacer SELLER API / Remittances with Line Item Breakdown
Back to Collection Items
var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
resp: HCkHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
CkHttp_putBasicAuth(http,True);
CkHttp_putLogin(http,'{{username}}');
CkHttp_putPassword(http,'{{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}"
// }
json := CkJsonObject_Create();
CkJsonObject_UpdateString(json,'query','query GetRemittancesWithLineItemBreakdown(' + #10 + ' $pageSize: Int' + #10 + ' $endCursor: String' + #10 + ' $createdSince: ISO8601DateTime' + #10 + ') {' + #10 + ' remittances(' + #10 + ' first: $pageSize' + #10 + ' after: $endCursor' + #10 + ' createdSince: $createdSince' + #10 + ' ) {' + #10 + ' edges {' + #10 + ' node {' + #10 + ' amountCents' + #10 + ' #This section pulls in invoices based on their remited date' + #10 + #10 + ' invoice {' + #10 + ' id' + #10 + ' legacyId' + #10 + ' remittedAt' + #10 + ' #total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents' + #10 + ' totalCents' + #10 + ' commissionAmountCents' + #10 + ' merchantFeeCents' + #10 + ' shippingCostCents' + #10 + ' taxTotalCents' + #10 + ' lineItems {' + #10 + ' id' + #10 + ' #total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents' + #10 + ' totalCents' + #10 + ' itemAmountCents' + #10 + ' subtotalCents' + #10 + ' commissionAmountCents' + #10 + ' postageCents' + #10 + ' taxTotalCents' + #10 + ' }' + #10 + ' }' + #10 + ' #This section pulls in amendments based on their remited date' + #10 + ' invoiceAmendment {' + #10 + ' id' + #10 + ' legacyId' + #10 + ' remittedAt' + #10 + ' totalCents' + #10 + ' remittanceCents' + #10 + ' lineItemAmountTotalCents' + #10 + ' lineItemTaxTotalCents' + #10 + ' commissionAmountTotalCents' + #10 + ' commissionTaxTotalCents' + #10 + ' remittanceAmountTotalCents' + #10 + ' remittanceTaxTotalCents' + #10 + ' lineItems {' + #10 + ' amountCents' + #10 + ' taxCents' + #10 + ' totalCents' + #10 + ' lineItemAmountCents' + #10 + ' lineItemTaxCents' + #10 + ' commissionAmountCents' + #10 + ' commissionTaxCents' + #10 + ' remittanceAmountCents' + #10 + ' remittanceTaxCents' + #10 + ' lineItem {' + #10 + ' id' + #10 + ' itemAmountCents' + #10 + ' taxTotalCents' + #10 + ' externalIds {' + #10 + ' key' + #10 + ' value' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' #this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments' + #10 + ' invoice {' + #10 + ' legacyId' + #10 + ' remittedAt' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + '}' + #10);
CkJsonObject_UpdateString(json,'variables','{' + #10 + ' "pageSize": 50,' + #10 + ' "endCursor": "",' + #10 + ' "createdSince": "2022-01-22T09:30:46-08:00"' + #10 + '}');
CkHttp_SetRequestHeader(http,'Content-Type','application/json');
CkHttp_SetRequestHeader(http,'MARKETPLACER-API-KEY','{{api_key}}');
resp := CkHttp_PostJson3(http,'https://bestfriendbazaar.com/graphql','application/json',json);
if (CkHttp_getLastMethodSuccess(http) = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
Memo1.Lines.Add(IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(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": [
]
}