Salesforce Billing Standard Objects
REST API for Converting Invoice Lines with Negative Balances
InvoiceAPI Class
Previous Versions
Global API Apex class for Salesforce Billing. Contains methods that you can call to cancel and rebill an invoice, or to credit an invoice.
blng
The InvoiceAPI class contains the creditInvoice method, which can be used to cancel and rebill an invoice, or to credit an invoice for a specified invoice ID.
Learn more about the methods available with the InvoiceAPI class.
Learn more about the methods available with the InvoiceAPI class.
The InvoiceAPI class includes these methods.
creditInvoice(invoiceId, action)
Use this method to cancel or rebill an invoice, or to credit an invoice.
Use this method to cancel or rebill an invoice, or to credit an invoice.
global static String creditInvoice(Id invoiceId, String action)
invoiceId: Type: String ID of the invoice.
action: Type: String
Action to perform against the invoice. For example, Credit or Cancel and Rebill.
Valid values are:
Credit—The invoice must be in the Posted status.
Cancel and Rebill—
If the invoice is in Posted status, then this action creates a credit note equal to the invoice’s total balance. The credit note contains credit note lines that are allocated in full to each of the invoice lines. This action also reverts the billing fields of an order product to their previous values. The status of the invoice is changed to Rebilled.
If the invoice is in Draft status, then Salesforce Billing sets the status to Cancelled for the invoice and all invoice lines. This action also sets theInvoice Run Processing Status field of the order products to Pending Billing status.
Type: String
Keep these considerations in mind when using this method.
Credit and Cancel and Rebill actions. The status of the invoice is changed to Credited.For more information about Cancel and Rebill, as well as Credit actions, see Issuing Credits.
1blng.InvoiceAPI.creditInvoice('aF15t000000GmjKCAS', 'Cancel and Rebill');1blng.InvoiceAPI.creditInvoice('aF15t000000GmjKCAS', 'Credit');