Global API
...
Request
Payment

Create

1min
here is the below example on how to to create a payment using breadwinners global api request // create a map to store all the data of a payment list\<object> paymentslist = new list\<object>(); map\<string, object> paymentmap = new map\<string, object>(); paymentmap put('datestring', '2021 11 11t00 00 00'); paymentmap put('amount', 50); paymentmap put('reference', 'test payment'); // initializing the invoice map\<string, object> invoicemap = new map\<string, object>(); invoicemap put('invoiceid', '93151e60 3cad 4384 a2ed 99935444a218'); paymentmap put('invoice', invoicemap); map\<string, object> accountmap = new map\<string, object>(); accountmap put('code', '880'); paymentmap put('account', accountmap); paymentslist add(paymentmap); // initializing the requestjson data to be passed map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('payments', paymentslist); string reqjson = json serialize(reqjsonmap); map\<string, object> finalreqmap = new map\<string, object>(); map\<string, object> reqoptions = new map\<string, object>(); finalreqmap put('queryparameters', reqoptions); finalreqmap put('version', '1 0'); finalreqmap put('action', 'createpayment'); finalreqmap put('requestjson', reqjson); finalreqmap put('skipdml', false); //required, if xero multi org is enabled in breadwinner finalreqmap put('xeroorgid', '!aa00tm'); system debug('request ' + finalreqmap); // placing a request to breadwinner global api map\<string, object> respmap = bread winner breadwinnerxeroapi call(finalreqmap); system debug('response ' + respmap); response { action=createpayment, responsejson={ "statuscode" 200, "payments" \[ { "updateddateutc" "/date(1640247312807+0000)/", "status" "authorised", "salesforcerecordid" 'a056o00005cgjig', "reference" "test payment", "paymenttype" "accrecpayment", "paymentid" "731c9d1e 4669 42d4 b369 508a293d1429", "isreconciled"\ false, "invoice" { "type" "accrec", "payments"\ null, "lineitems" \[ { "unitamount" 100 00, "tracking" \[ ], "taxtype" "output", "taxamount" 0 00, "quantity" 10 0000, "lineitemid" "883a96f4 6ab8 4241 9822 4aa38c700b5b", "lineamount" 1000 00, "itemcode"\ null, "discountrate"\ null, "description" "line item description updated", "accountcode" "200" } ], "isdiscounted"\ false, "invoicenumber" "inv 0007", "invoiceid" "93151e60 3cad 4384 a2ed 99935444a218", "haserrors"\ false, "currencycode" "inr", "creditnotes"\ null, "contact" { "name" "breadwinner inc1", "contactstatus"\ null, "contactid" "f3044b57 fa66 4a8c 9bfe 7a4638764adf" }, "amountpaid" 110 00, "amountdue" 890 00 }, "hasaccount"\ true, "datevariable" "/date(1640217600000+0000)/", "currencyrate" 1 0000000000, "creditnote"\ null, "batchpaymentid"\ null, "batchpayment"\ null, "bankamount" 50 00, "amount" 50 00, "account" { "code" "880", "accountid" "72bae77e 149a 4d3b 8dac 06bfca1dd3e4" } } ], "errors" \[ ] }, timestamp=1636643112614, validrequest=true, version=1 0 }