Global API
...
Invoice
Invoice - Stripe
Create and Charge
1min
to create and charge an invoice in stripe, use the action "createinvoice," collectionmethod as "charge automatically," invoicestatus as "charge customer" and pass the invoice data in the requestjson under "invoices " note you can only create one record at a time the following is an example of create and charge an invoice, where we are setting every possible field (see https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/hnjmkn99qxwdeafyyifsq invoice stripe docid\ jg10ugmtnbrsw2a0wbe1k for the available fields) the response will return the response from stripe, which includes the new stripe invoice id ( internalid ), plus the newly created salesforce invoice id ( salesforceid ) map\<string, object> invoicedata = new map\<string, object>(); invoicedata put('processorcustomerid', 'processorcustomerid'); invoicedata put('collectionmethod', 'charge automatically'); invoicedata put('invoicestatus', 'charge customer'); invoicedata put('processorpaymentmethodid', 'processorpaymentmethodid'); list\<object> items = new list\<object>(); map\<string, object> itemdata = new map\<string, object>(); itemdata put('processorpriceid', 'processorpriceid'); itemdata put('quantity', 2); items add(itemdata); invoicedata put('items', items); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('invoices', new list\<object>{invoicedata}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version','1 0'); reqobj put('action','createinvoice'); reqobj put('processorid', 'processorid'); reqobj put('requestjson',reqjson); // placing a request to breadwinner global api map\<string,object> resp = bw payments breadwinnerpaymentsapi call(reqobj); system debug(resp);{ action=createinvoice, version=1 0, responsejson={ "invoices" \[ { "status" "paid", "salesforceid" "salesforceinvoiceid", "salesforcecontact" null, "salesforceaccount" null, "processorpaymentmethodid" null, "processororgid" "processororgid", "processorinvoiceid" "processorinvoiceid", "processorcustomerid" null, "items" \[ { "unitamountdecimal" 100 00, "unitamount" 100 00, "salesforcesubscriptionid" null, "salesforcepriceid" "salesforcepriceid", "salesforceinvoiceid" null, "salesforceid" "salesforcelineitemid", "quantity" 2, "processorsubscriptionid" null, "processorpriceid" null, "processorinvoiceid" "processorinvoiceid", "processorid" "processorid", "name" null, "metadataasstring" null, "errormessage" null, "description" "test product 123", "deleted" null, "chargecurrency" "usd", "amount" 200 00 } ], "errormessage" null, "duedate" null, "description" null, "createdvia" "breadwinner", "createddateinprocessor" "2023 09 27t09 29 04 000z", "collectionmethod" "charge automatically" } ] }, statuscode=null, timestamp=1695806947688, validrequest=true }