Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. 

If you need assistance with this, please reach out to our list of consultants for further assistance:

Add a new membership record.


  • $args (array) - An array of arguments.
    • $customer_id (int) - Required. The ID of the customer this membership is for.
    • $object_id (int) - Required. The ID of the membership level this membership is for.
    • $object_type (string) - Optional. The type of object. The default is `membership`.
    • $currency (string) - Optional. Currency used for membership. Default is the currency specified in Restrict > Settings > Payments.
    • $initial_amount (string) - Optional. Amount charged on initial registration. The default is `0.00`.
    • $recurring_amount (string) - Optional. Amount charged for renewals. The default is `0.00`.
    • $created_date (string) - Optional. The date the membership was created in MySQL format. The default is the current date and time.
    • $trial_end_date (string) - Optional. The date the integrated free trial ends. If omitted, this will be set automatically based on the customer's free trial allowance and whether or not the associated object ID has a built-in trial.
    • $expiration_date (string) - Optional. The date the membership expires or renews, in MySQL format. Use `none` if the membership never expires. If omitted, this is auto-calculated based on the associated object ID.
    • $auto_renew (bool) - Optional. TRUE if this membership has auto-renew enabled, FALSE if it does not. Default `false`.
    • $times_billed (int) - Optional. The number of times this membership has been billed for so far. Default `0`.
    • $status (string) - Optional. Status of the membership. Accepts: pending, active, canceled, expired. Default `pending`.
    • $gateway_customer_id (string) - Optional. Gateway customer ID. Default empty.
    • $gateway_subscription_id (string) - Optional. Gateway subscription ID. Default empty.
    • $gateway (string) - Optional. The slug of the gateway. Default empty.
    • $signup_method (string) - Optional. Signup method. Accepts: live, manual, imported. Default `live`.
    • $subscription_key (string) - Optional. Unique subscription key for this membership. Default empty.
    • $notes (string) - Optional. Notes for the membership. Setting this manually here is not recommended. Default empty.
    • $upgraded_from (int) - Optional. The ID of membership this one was upgraded from. Default empty.
    • $disabled (int) - Optional. Whether this membership is disabled (1) or enabled (0). Default `0`.

Return values:

  • (int|false) - ID of the newly created membership on success, or false on failure.


Creates a new, active membership for customer #50 on membership level #2:

$membership_id = rcp_add_membership( array(
    'customer_id' => 50,
    'object_id' => 2,
    'status' => 'active'
) );
Have more questions? Submit a request
Powered by Zendesk