Creating Credit Balance Adjustments

From API Documentation

Jump to: navigation, search

Using  Credit Balance Adjustments you can increase or decrease a customer's credit balance.  WIth Credit Balance Adjustments, you can handle many use cases, such as

  • Increasing Credit Balance
    • Accept and track an overpayment from a customer
    • Apply credit from a negative balance invoice
  • Decreasing Credit Balance
    • Apply credit to an existing invoice (ie, pay for an invoice with funds from the customer's credit balance)
    • Cancel a previous positive (increasing) adjustment
    • Refund money to a customer from their credit balance


To create a Credit Balance Adjustment

  1. Use the create() call for a CreditBalanceAdjustment object
  2. Specify the SourceTransactionId or SourceTransactionNumber - this is most likely the Invoice.Id or Invoice.Number that you want to transfer to/from

Example SOAP calls for creating CreditBalanceAdjustments

Adjust a Negative Invoice and Transfer The Balance To a Customer's Credit Balance By Specifying SourceTransactionId

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <soapenv:Header>
        <ns1:SessionHeader xmlns:ns1="http://api.zuora.com/" soapenv:mustUnderstand="0">
           <ns1:session>B4EpRix4IEuLkbTv2fOD0nQLZfNqBNb3lB1VX/JosCxxuZjQULOSbw+OWkGzX12+NMRkXSDNHXgpryh8N6kGZw==</ns1:session>
        </ns1:SessionHeader>
     </soapenv:Header>
     <soapenv:Body>
        <ns1:create xmlns:ns1="http://api.zuora.com/">
           <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:CreditBalanceAdjustment">
              <ns2:Type>Increase</ns2:Type>
              <ns2:Amount>12</ns2:Amount>
              <ns2:Comment>transfer negative invoice to Credit Balance</ns2:Comment>
              <ns2:ReferenceId>reference id</ns2:ReferenceId>
              <ns2:AccountingCode>ac1</ns2:AccountingCode>
              <ns2:SourceTransactionId>402892q028903c510128903e26a800e3</ns2:SourceTransactionId>  
           </ns1:zObjects>
        </ns1:create>
     </soapenv:Body>
  </soapenv:Envelope>


Adjust a Negative Invoice and Transfer The Balance To a Customer's Credit Balance By Specifying SourceTransactionNumber

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header>
   <ns1:SessionHeader xmlns:ns1="http://api.zuora.com/" soapenv:mustUnderstand="0">
     <ns1:session>B4EpRix4IEuLkbTv2fOD0nQLZfNqBNb3lB1VX/JosCxxuZjQULOSbw+OWkGzX12+NMRkXSDNHXgpryh8N6kGZw==</ns1:session>
   </ns1:SessionHeader>
 </soapenv:Header>
 <soapenv:Body>
   <ns1:create xmlns:ns1="http://api.zuora.com/">
      <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:CreditBalanceAdjustment">
         <ns2:Type>Increase</ns2:Type>
         <ns2:Amount>12</ns2:Amount>
         <ns2:Comment>transfer negative invoice to Credit Balance</ns2:Comment>
         <ns2:ReferenceId>reference id</ns2:ReferenceId>
         <ns2:AccountingCode>ac1</ns2:AccountingCode>
         <ns2:SourceTransactionNumber>INV00005434</ns2:SourceTransactionNumber>  
      </ns1:zObjects>
   </ns1:create>
 </soapenv:Body>
</soapenv:Envelope>



Apply Funds From The Credit Balance Towards An Outstanding Invoice

<?xml version='1.0' encoding='UTF-8'?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
   <ns1:SessionHeader xmlns:ns1="http://api.zuora.com/" soapenv:mustUnderstand="0">
     <ns1:session>B4EpRix4IEuLkbTv2fOD0nQLZfNqBNb3lB1VX/JosCxxuZjQULOSbw+OWkGzX12+NMRkXSDNHXgpryh8N6kGZw==</ns1:session>
   </ns1:SessionHeader>
  </soapenv:Header>
  <soapenv:Body>
   <ns1:create xmlns:ns1="http://api.zuora.com/">
   <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:CreditBalanceAdjustment">
       <ns2:Amount>40</ns2:Amount>
       <ns2:Comment>Apply $40 from the Credit Balance to Invoice INV00005434</ns2:Comment>
       <ns2:AccountingCode>ac1</ns2:AccountingCode>
       <ns2:SourceTransactionNumber>INV00005434</ns2:SourceTransactionNumber>
       <ns2:Type>Decrease</ns2:Type>
   </ns1:zObjects>
  </ns1:create>
 </soapenv:Body>
 </soapenv:Envelope>



Create A Credit Balance and Specifying Both SourceTransactionNumber and SourceTransactionId
NOTE: If you specify both SourceTransactionNumber and SourceTransactionId, they must correspond to the same invoice

<?xml version='1.0' encoding='UTF-8'?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
   <ns1:SessionHeader xmlns:ns1="http://api.zuora.com/" soapenv:mustUnderstand="0">
     <ns1:session>B4EpRix4IEuLkbTv2fOD0nQLZfNqBNb3lB1VX/JosCxxuZjQULOSbw+OWkGzX12+NMRkXSDNHXgpryh8N6kGZw==</ns1:session>
   </ns1:SessionHeader>
  </soapenv:Header>
  <soapenv:Body>
   <ns1:create xmlns:ns1="http://api.zuora.com/">
   <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:CreditBalanceAdjustment">
       <ns2:Type>Increase</ns2:Type>
       <ns2:Amount>12</ns2:Amount>
       <ns2:Comment>transfer negative invoice to Credit Balance</ns2:Comment>
       <ns2:ReferenceId>reference id</ns2:ReferenceId>
       <ns2:AccountingCode>ac1</ns2:AccountingCode>
       <ns2:SourceTransactionNumber>INV00005434</ns2:SourceTransactionNumber>
       <ns2:SourceTransactionId>402892q028903c510128903e26a800e3</ns2:SourceTransactionId>  
   </ns1:zObjects>
  </ns1:create>
 </soapenv:Body>
 </soapenv:Envelope>