This documentation relates to CiviCRM version 3.2. It's not maintained anymore.
Current version of documentation.

Membership APIs

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.


Documentation Search


CiviCRM 3.2 Documentation

Support and Participation

Developer Resources


CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

Membership APIs

civicrm_contact_membership_create( &$params )

Availability: v1.8

Add or update the membership

Parameters:

  • 'params' (array) array of name-value for membership
  • for updating membership record pass membership id in array like $params['id']

Returns:

  • (array) id of created/updated Membership on success, error message otherwise
    Tips - Creating Contact Memberships
    • You must include all dates, CiviCRM will not calculate them for you like it does in the UI.
    • The dates given must map to a valid membership status. Otherwise you receive the error: "The membership can not be saved, no valid membership status for given dates"
    • If you want CiviCRM to determine the dates for you, you can use code like this to add them to your $params array:
    Create Membership
    Result

civicrm_contact_memberships_get( $contactID )

Availability: v1.8

Retrive memberships for a given contact.

Parameters:

  • 'contactID' (Integer) Contact id
    Returns:
  • array of membership values for the given contact
    Get Memberships
    Result

civicrm_membership_contact_get( &$params )

Retrieve memberships for a given contact.

Parameters:

  • 'params' an array of name-value pair of membership attributes
    Returns:
  • array of membership values for the given contact
    Get Contact Memberships
    Result

civicrm_membership_delete( &$membershipID )

Availability: v1.8

Delete the specified membership record.

Parameters:

  • 'membershipID' (Integer) Membership id

Returns:

  • success message if successful, error message otherwise
    Membership Delete
    Result

civicrm_contact_membership_type_create( &$params )

Availability: v1.8

Add a membership type

Parameters:

  • 'params' (array) array of name-value for membership type

Returns:

  • (array) id of created membership type on success, error message otherwise
    Create Membership Type
    Result

civicrm_contact_membership_type_update( &$params )

Availability: v1.8

Update a membership type

Parameters:

  • 'params' (array) array of name-value for membership type

Returns:

  • (array) of updated membership type on success, error message otherwise
    Update Membership Type
    Result

civicrm_membership_types_get( $params )

Availability: v1.8

Retrieve a specific Membership Type, given a set of input params

Parameters:

  • 'params' (array) Array of name-value for Membership Type

Returns:

  • array of Membership Type values
    Get Membership Type
    Result

civicrm_membership_type_delete( $params )

Availability: v1.8

Delete a specific Membership Type.

Parameters:

  • Array containing a specific membership type id

Returns:

  • success message if successful, error message otherwise
    Delete Membership Type
    Result

civicrm_contact_membership_status_create( &$params )

Availability: v1.8

Add a Membership Status

Parameters:

  • 'params' (array) array of name-value for Membership Status

Returns:

  • (array) id of created Membership Status on success, error message otherwise
    Create Membership Status
    Result

civicrm_contact_membership_status_update( &$params )

Availability: v1.8

Update a Membership Status

Parameters:

  • 'params' (array) array of name-value for Membership Status
    Returns:
  • (array) of updated Membership Status on success, error message otherwise
    Update Membership Status
    Result

civicrm_membership_statuses_get( $params )

Availability: v1.8

Retrieve a specific Membership Status, given a set of input params

Parameters:

  • 'params' (array) Array of name-value for Membership Status

Returns:

  • array of Membership Status values
    Get Membership Status
    Result

civicrm_membership_status_delete( $params )

Availability: v1.8

Delete a specific Membership Status.

Parameters:

  • Array containing a specific Membership Status id

Returns:

  • success message if successful, error message otherwise
    Delete Membership Status
    Result

civicrm_membership_status_calc( $params )

Availability: v1.8

Calculates Membership Status.

Parameters:

  • 'params' (array) Array of name-value for Membership Status Calculation
    Returns:
  • success message if successful, error message otherwise
    Membership Status Calculation
    Result

Membership Contribution APIs

civicrm_membershipcontributionlink_create( &$params )

Availability: v2.1

Create membership Payment

Parameters:

  • 'params' (array) array of membership_id and contribution_id

Returns:

  • Array of Membership Payment on success, error message otherwise
    Create Membership-Contribution
    Result

civicrm_membershipcontributionlink_get( &$params )

Availability: v2.1

Get membership Payment

Parameters:

  • 'params' (array) array of membership_contribution_id (Membership Payment ID)

Returns:

  • Array of Membership Payment on success, error message otherwise
    Get Membership-Contribution
    Result
Labels
  • None

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.