3 * Test Generated example demonstrating the ContributionPage.submit API.
5 * submit contribution page
10 function contribution_page_submit_example() {
13 'pledge_amount' => array(
16 'billing_first_name' => 'Billy',
17 'billing_middle_name' => 'Goat',
18 'billing_last_name' => 'Gruff',
19 'email' => 'billy@goat.gruff',
20 'payment_processor_id' => 1,
21 'credit_card_number' => '4111111111111111',
22 'credit_card_type' => 'Visa',
23 'credit_card_exp_date' => array(
33 'pledge_block_id' => 2,
37 $result = civicrm_api3('ContributionPage', 'submit', $params);
39 catch (CiviCRM_API3_Exception
$e) {
41 $errorMessage = $e->getMessage();
42 $errorCode = $e->getErrorCode();
43 $errorData = $e->getExtraParams();
46 'error_message' => $errorMessage,
47 'error_code' => $errorCode,
48 'error_data' => $errorData,
56 * Function returns array of result expected from previous function.
61 function contribution_page_submit_expectedresult() {
63 $expectedResult = array(
70 return $expectedResult;
74 * This example has been generated from the API test suite.
75 * The test that created it is called "testSubmitPledgePayment"
76 * and can be found at:
77 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
79 * You can see the outcome of the API tests at
80 * https://test.civicrm.org/job/CiviCRM-master-git/
82 * To Learn about the API read
83 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
85 * Browse the api on your own site with the api explorer
86 * http://MYSITE.ORG/path/to/civicrm/api
88 * Read more about testing here
89 * http://wiki.civicrm.org/confluence/display/CRM/Testing
91 * API Standards documentation:
92 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards