Documentation

Contribution.php

This api exposes CiviCRM Contribution records.

Table of Contents

Functions

civicrm_api3_contribution_create()  : array<string|int, mixed>
Add or update a Contribution.
_civicrm_api3_contribution_create_spec()  : mixed
Adjust Metadata for Create action.
_civicrm_api3_contribution_create_legacy_support_45()  : mixed
Support for schema changes made in 4.5.
civicrm_api3_contribution_delete()  : array<string|int, mixed>
Delete a Contribution.
_civicrm_api3_contribution_delete_spec()  : mixed
Modify metadata for delete action.
civicrm_api3_contribution_get()  : array<string|int, mixed>
Retrieve a set of contributions.
_civicrm_api3_contribution_get_support_nonunique_returns()  : array<string|int, mixed>
Fix the return values to reflect cases where the schema has been changed.
_civicrm_api3_contribution_add_supported_fields()  : mixed
Support for supported output variables.
civicrm_api3_contribution_getcount()  : int
Get number of contacts matching the supplied criteria.
_civicrm_api3_format_soft_credit()  : mixed
This function is used to format the soft credit for backward compatibility.
_civicrm_api3_contribution_get_spec()  : mixed
Adjust Metadata for Get action.
_civicrm_api3_contribute_format_params()  : array<string|int, mixed>
Legacy handling for contribution parameters.
civicrm_api3_contribution_sendconfirmation()  : mixed
Send a contribution confirmation (receipt or invoice).
_civicrm_api3_contribution_sendconfirmation_spec()  : mixed
Adjust Metadata for sendconfirmation action.
civicrm_api3_contribution_completetransaction()  : array<string|int, mixed>
Complete an existing (pending) transaction.
_civicrm_api3_contribution_completetransaction_spec()  : mixed
Provide function metadata.
civicrm_api3_contribution_repeattransaction()  : array<string|int, mixed>
Complete an existing (pending) transaction.
_civicrm_api3_contribution_repeattransaction_spec()  : mixed
Provide function metadata.
_civicrm_api3_contribution_deprecation()  : array<string|int, mixed>
Declare deprecated functions.

Functions

civicrm_api3_contribution_create()

Add or update a Contribution.

civicrm_api3_contribution_create(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Input parameters.

Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

Api result array

_civicrm_api3_contribution_create_spec()

Adjust Metadata for Create action.

_civicrm_api3_contribution_create_spec(array<string|int, mixed> &$params) : mixed

The metadata is used for setting defaults, documentation & validation.

Parameters
$params : array<string|int, mixed>

Array of parameters determined by getfields.

_civicrm_api3_contribution_create_legacy_support_45()

Support for schema changes made in 4.5.

_civicrm_api3_contribution_create_legacy_support_45(array<string|int, mixed> &$params) : mixed

The main purpose of the API is to provide integrators a level of stability not provided by the core code or schema - this means we have to provide support for api calls (where possible) across schema changes.

Parameters
$params : array<string|int, mixed>

civicrm_api3_contribution_delete()

Delete a Contribution.

civicrm_api3_contribution_delete(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Input parameters.

Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

_civicrm_api3_contribution_delete_spec()

Modify metadata for delete action.

_civicrm_api3_contribution_delete_spec(array<string|int, mixed> &$params) : mixed

Legacy support for contribution_id.

Parameters
$params : array<string|int, mixed>

civicrm_api3_contribution_get()

Retrieve a set of contributions.

civicrm_api3_contribution_get(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Input parameters.

Return values
array<string|int, mixed>

Array of contributions, if error an array with an error id and error message

_civicrm_api3_contribution_get_support_nonunique_returns()

Fix the return values to reflect cases where the schema has been changed.

_civicrm_api3_contribution_get_support_nonunique_returns(array<string|int, mixed> $params) : array<string|int, mixed>

At the query object level using uniquenames dismbiguates between tables.

However, adding uniquename can change inputs accepted by the api, so we need to ensure we are asking for the unique name return fields.

Parameters
$params : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

_civicrm_api3_contribution_add_supported_fields()

Support for supported output variables.

_civicrm_api3_contribution_add_supported_fields(array<string|int, mixed> &$contribution) : mixed
Parameters
$contribution : array<string|int, mixed>

civicrm_api3_contribution_getcount()

Get number of contacts matching the supplied criteria.

civicrm_api3_contribution_getcount(array<string|int, mixed> $params) : int
Parameters
$params : array<string|int, mixed>
Return values
int

_civicrm_api3_format_soft_credit()

This function is used to format the soft credit for backward compatibility.

_civicrm_api3_format_soft_credit(array<string|int, mixed> &$contribution) : mixed

As of v4.4 we support multiple soft credit, so now contribution returns array with 'soft_credit' as key but we still return first soft credit as a part of contribution array

Parameters
$contribution : array<string|int, mixed>

_civicrm_api3_contribution_get_spec()

Adjust Metadata for Get action.

_civicrm_api3_contribution_get_spec(array<string|int, mixed> &$params) : mixed

The metadata is used for setting defaults, documentation & validation.

Parameters
$params : array<string|int, mixed>

Array of parameters determined by getfields.

_civicrm_api3_contribute_format_params()

Legacy handling for contribution parameters.

_civicrm_api3_contribute_format_params(array<string|int, mixed> $params, array<string|int, mixed> &$values) : array<string|int, mixed>

Take the input parameter list as specified in the data model and convert it into the same format that we use in QF and BAO object.

Parameters
$params : array<string|int, mixed>

property name/value pairs to insert in new contact.

$values : array<string|int, mixed>

The reformatted properties that we can use internally.

Return values
array<string|int, mixed>

civicrm_api3_contribution_sendconfirmation()

Send a contribution confirmation (receipt or invoice).

civicrm_api3_contribution_sendconfirmation(array<string|int, mixed> $params) : mixed

The appropriate online template will be used (the existence of related objects (e.g. memberships ) will affect this selection

Parameters
$params : array<string|int, mixed>

Input parameters.

Tags
throws
Exception

_civicrm_api3_contribution_sendconfirmation_spec()

Adjust Metadata for sendconfirmation action.

_civicrm_api3_contribution_sendconfirmation_spec(array<string|int, mixed> &$params) : mixed

The metadata is used for setting defaults, documentation & validation.

Parameters
$params : array<string|int, mixed>

Array of parameters determined by getfields.

civicrm_api3_contribution_completetransaction()

Complete an existing (pending) transaction.

civicrm_api3_contribution_completetransaction(array<string|int, mixed> $params) : array<string|int, mixed>

This will update related entities (participant, membership, pledge etc) and take any complete actions from the contribution page (e.g. send receipt).

Parameters
$params : array<string|int, mixed>

Input parameters.

Tags
todo
  • most of this should live in the BAO layer but as we want it to be an addition to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
throws
CRM_Core_Exception
throws
Exception
Return values
array<string|int, mixed>

API result array

_civicrm_api3_contribution_completetransaction_spec()

Provide function metadata.

_civicrm_api3_contribution_completetransaction_spec(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

civicrm_api3_contribution_repeattransaction()

Complete an existing (pending) transaction.

civicrm_api3_contribution_repeattransaction(array<string|int, mixed> $params) : array<string|int, mixed>

This will update related entities (participant, membership, pledge etc) and take any complete actions from the contribution page (e.g. send receipt).

Parameters
$params : array<string|int, mixed>

Input parameters.

Tags
todo
  • most of this should live in the BAO layer but as we want it to be an addition to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
todo

this needs a big refactor to use the CRM_Contribute_BAO_Contribution::repeatTransaction and Payment.create where currently it uses CRM_Contribute_BAO_Contribution::completeOrder and repeats a lot of work. See comments in https://github.com/civicrm/civicrm-core/pull/23928

throws
CRM_Core_Exception
Return values
array<string|int, mixed>

Api result array.

_civicrm_api3_contribution_repeattransaction_spec()

Provide function metadata.

_civicrm_api3_contribution_repeattransaction_spec(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

_civicrm_api3_contribution_deprecation()

Declare deprecated functions.

_civicrm_api3_contribution_deprecation() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of deprecated actions


        
On this page

Search results