Import Batches

The Import Batches service allows you to directly create batches with full transaction information in the Pushpay database. In order to import the batches, an XML file with the designated structure must be sent with the service call.

Service Name

import_batches

Parameters for Batch

NameTypeDescription
namestring[50]optional will be appended with API
campus idintXML attribute on <campus> element. Defaults to first campus if not provided.
post_datedateif not valid will be set to today
begin_datedateoptional, defaults to earliest transaction date
end_datedateoptional, defaults to latest transaction date
batch_idintoptional
in_accounting_packagebooleanoptional
creator idintoptional, XML attribute on <creator> element
modifier idintoptional, XML attribute on <modifier> element
createddatetimeoptional
modifieddatetimeoptional
transactionssee below

Parameters for Transaction

NameTypeDescription
merchant_transaction_idstring[75]optional, XML attribute on <transaction> element
individual idintXML attribute on <individual> element. If not valid the entire import will stop.
datedateif not valid will be set to post_date
grouping idintoptional, XML attribute on <grouping> element
payment_typestringMust be either cash, check, online, or other
check_numberintoptional
merchant_namestring[50]optional
merchant_individual_idstring[75]optional
creator idintoptional, XML attribute on <creator> element. Inherits from batch if not provided.
modifier idintoptional, XML attribute on <modifier> element. Inherits from batch if not provided.
createddatetimeoptional
modifieddatetimeoptional
transaction_detailssee below

Parameters for Transaction Details (Split Payments)

NameTypeDescription
transaction_detail_idintoptional, XML attribute on <transaction_detail> element
coa idintXML attribute on <coa> element. Either coa id or fund_key is required.
coa fund_keystring[36]XML attribute on <coa> element. Alternative to coa id.
amountfloat
tax_deductibleDeprecated — this will be set by COA category
notestring[90]

Example Curl

curl -u user:password -F filedata=@your_local_file_location "http://your_test_site/api.php?srv=import_batches"

Example Input XML

<?xml version="1.0" encoding="UTF-8"?>
<ccb_api>
     <batch id="19">
          <campus id="1"></campus>
          <post_date>2013-11-12</post_date>
          <transactions>
               <transaction id="44" merchant_transaction_id="abc-123">
                    <individual id="48"></individual>
                    <date>2006-05-04</date>
                    <grouping id="1"></grouping>
                    <payment_type>Cash</payment_type>
                    <check_number></check_number>
                    <merchant_name></merchant_name>
                    <merchant_individual_id></merchant_individual_id>
                    <transaction_details>
                         <transaction_detail id="44">
                              <coa id="1"></coa>
                              <amount>250.32</amount>
                              <note>note0</note>
                         </transaction_detail>
                         <transaction_detail id="45">
                              <coa id="2"></coa>
                              <amount>10.35</amount>
                              <note></note>
                         </transaction_detail>
                    </transaction_details>
               </transaction>
               <transaction id="45">
                    <campus id="2"></campus>
                    <individual id="50"></individual>
                    <date>2006-05-04</date>
                    <grouping id=""></grouping>
                    <payment_type>Check</payment_type>
                    <check_number>1234</check_number>
                    <merchant_name></merchant_name>
                    <merchant_individual_id></merchant_individual_id>
                    <transaction_details>
                         <transaction_detail id="46">
                              <coa id="2"></coa>
                              <amount>10</amount>
                              <note></note>
                         </transaction_detail>
                    </transaction_details>
               </transaction>
          </transactions>
     </batch>
</ccb_api>

Example Response XML

<?xml version="1.0" encoding="UTF-8"?>
<ccb_api>
     <request>
          <parameters>
               <argument value="import_batches" name="srv"/>
          </parameters>
     </request>
     <response>
          <service>import_batches</service>
          <service_action>execute</service_action>
          <availability>public</availability>
          <batches count="1">
               <batch id="1410">
                    <campus id="1">User Experience Campus</campus>
                    <post_date>2013-11-12</post_date>
                    <begin_date>2016-03-04</begin_date>
                    <end_date>2016-03-04</end_date>
                    <in_accounting_package>false</in_accounting_package>
                    <status>Closed</status>
                    <source>Created through API</source>
                    <transactions>
                         <transaction id="2815">
                              <campus id="1">User Experience Campus</campus>
                              <individual id="48">Amy Arnold</individual>
                              <date>2006-05-04</date>
                              <grouping id="1">3rd</grouping>
                              <payment_type>Cash</payment_type>
                              <check_number></check_number>
                              <transaction_details>
                                   <transaction_detail id="3271">
                                        <coa id="1">Other</coa>
                                        <amount>250.32</amount>
                                        <tax_deductible>true</tax_deductible>
                                        <note>note0</note>
                                        <creator id="0">System User</creator>
                                        <modifier id="0">System User</modifier>
                                        <created>2016-03-04 01:25:04</created>
                                        <modified>2016-03-04 01:25:04</modified>
                                   </transaction_detail>
                                   <transaction_detail id="3272">
                                        <coa id="2">Benevolence</coa>
                                        <amount>10.35</amount>
                                        <tax_deductible>true</tax_deductible>
                                        <note></note>
                                        <creator id="0">System User</creator>
                                        <modifier id="0">System User</modifier>
                                        <created>2016-03-04 01:25:04</created>
                                        <modified>2016-03-04 01:25:04</modified>
                                   </transaction_detail>
                              </transaction_details>
                              <creator id="0">System User</creator>
                              <modifier id="0">System User</modifier>
                              <created>2016-03-04 01:25:04</created>
                              <modified>2016-03-04 01:25:04</modified>
                         </transaction>
                         <transaction id="2816">
                              <campus id="1">User Experience Campus</campus>
                              <individual id="50">Noell Arrington</individual>
                              <date>2006-05-04</date>
                              <grouping id=""></grouping>
                              <payment_type>Check</payment_type>
                              <check_number>1234</check_number>
                              <transaction_details>
                                   <transaction_detail id="3273">
                                        <coa id="2">Benevolence</coa>
                                        <amount>10</amount>
                                        <tax_deductible>true</tax_deductible>
                                        <note></note>
                                        <creator id="0">System User</creator>
                                        <modifier id="0">System User</modifier>
                                        <created>2016-03-04 01:25:04</created>
                                        <modified>2016-03-04 01:25:04</modified>
                                   </transaction_detail>
                              </transaction_details>
                              <creator id="0">System User</creator>
                              <modifier id="0">System User</modifier>
                              <created>2016-03-04 01:25:04</created>
                              <modified>2016-03-04 01:25:04</modified>
                         </transaction>
                    </transactions>
                    <creator id="0">System User</creator>
                    <modifier id="0">System User</modifier>
                    <created>2016-03-04 01:25:04</created>
                    <modified>2016-03-04 01:25:04</modified>
               </batch>
          </batches>
     </response>
</ccb_api>