4 Demonstrates creating contribution with SoftCredit
6 function contribution_create_example(){
9 'receive_date' => '20120511',
10 'total_amount' => '100',
11 'financial_type_id' => 1,
12 'non_deductible_amount' => '10',
16 'contribution_status_id' => 1,
18 'soft_credit_to' => 2,
21 $result = civicrm_api( 'contribution','create',$params );
27 * Function returns array of result expected from previous function
29 function contribution_create_expectedresult(){
31 $expectedResult = array(
40 'financial_type_id' => '1',
41 'contribution_page_id' => '',
42 'payment_instrument_id' => '',
43 'receive_date' => '20120511000000',
44 'non_deductible_amount' => '10',
45 'total_amount' => '100',
52 'cancel_reason' => '',
54 'thankyou_date' => '',
57 'contribution_recur_id' => '',
58 'honor_contact_id' => '',
61 'contribution_status_id' => '1',
62 'honor_type_id' => '',
66 'contribution_type_id' => '1',
71 return $expectedResult ;
76 * This example has been generated from the API test suite. The test that created it is called
78 * testCreateContributionWithSoftCredt and can be found in
79 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContributionTest.php
81 * You can see the outcome of the API tests at
82 * http://tests.dev.civicrm.org/trunk/results-api_v3
84 * To Learn about the API read
85 * http://book.civicrm.org/developer/current/techniques/api/
87 * and review the wiki at
88 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
90 * Read more about testing here
91 * http://wiki.civicrm.org/confluence/display/CRM/Testing
93 * API Standards documentation:
94 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards