Memberships

Create a Membership

Use this endpoint to create a new Membership. A Membership always requires a Customer, but for convenience, you can pass customer_data to create the customer inline and attach the membership to the newly created customer.

Unless you're authorised to do so, you'll only be permitted to create a membership for a private MembershipType and/or a non-default MembershipRate when you provide a valid MembershipSignupToken ID for the type and rate in question.

The status of newly created memberships is always reserved. You'll need to make a request to the confirmMembership endpoint to update the status once the pro-rata or joining fee payment has been paid.

post/customers/memberships

Headers

X-Trybe-On-Behalf-Ofstring uuid

The user ID of the user the request is made on behalf of.

Request body

customer_idstring

The Customer the new membership should be attached to. Mutually exclusive with customer_data: pass exactly one of customer_id (link to an existing customer) or customer_data (create a customer inline). The customer must belong to the same brand as the supplied membership_type_id.

site_idstring

The site ID which this membership belongs to

customer_dataobject

Inline customer data to create a new customer with the membership. See createCustomer for the full list of accepted fields.

membership_type_idstring required

The membership type ID. This must belong to the same brand as the given customer.

membership_rate_idstring required

The membership rate ID. This must belong to the same type as provided.

intake_form_requiredboolean

Whether an intake form is required for this membership

basket_idstring

The basket ID which was used to purchase this membership, if applicable.

source'app' | 'self_signup'

The source of where this membership was created.

external_refstring

Free-form identifier for cross-referencing this membership with an external system (e.g. a legacy CRM record number). Returned verbatim on getMembership and not interpreted by the platform.

start_datestring date required

The date which the membership should start from.

end_datestring date nullable required

The date which the membership should end.

Example request

{
  "customer_id": "5f8a1b2c-9d3e-4a5b-8c6d-7e8f9a0b1c2d",
  "site_id": "000000-000000-000000-000000",
  "membership_type_id": "000000-000000-000000-000000",
  "membership_rate_id": "000000-000000-000000-000000",
  "intake_form_required": true,
  "basket_id": "60c0c01d92ec44e252235966",
  "external_ref": "legacy-crm-7421",
  "start_date": "2021-01-01",
  "end_date": "2022-01-01"
}

Response

The Membership was successfully retrieved

Example response

{
  "data": {
    "customer": {
      "first_name": "Jane",
      "last_name": "Doe",
      "full_name": "Jane Doe",
      "phone": "+447900000000",
      "has_password": true,
      "stripe_id": "cus_1234567890",
      "express_stripe_id": "cus_1234567890",
      "email": "janedoe@example.com",
      "labels": [
        {
          "value": "VIP",
          "colour": "ff6634"
        }
      ],
      "preferred_locale": "en",
      "last_check_in": {
        "method": "Scanned"
      },
      "avatar_id": "000000-000000-000000-000000",
      "avatar": {
        "file_name": "super-cool-photo.jpg",
        "mime_type": "image/jpeg",
        "original_url": "https://example.com/media/super-cool-photo.jpg",
        "size": 84256,
        "url": "https://example.com/media/super-cool-photo-thumbnail@2x.jpg"
      },
      "external_ref": "ext-cust-789012"
    },
    "members": [
      {
        "membership_number": "1234567890"
      }
    ],
    "membership_number": "1234567890",
    "next_charge": {
      "amount": 3995,
      "currency": "GBP"
    },
    "payment_method": {
      "status": "revoked",
      "card_brand": "amex"
    },
    "rate": {
      "name": "Standard rate",
      "currency": "GBP",
      "price": 5000,
      "joining_fee": 1000,
      "billing_frequency": "P1M",
      "default_duration": "P1Y",
      "notice_period": "P1M",
      "private": true
    },
    "type": {
      "name": "Gold tier",
      "description": "Enjoy exclusive benefits as part of being a member in our Gold tier",
      "min_members": 2,
      "max_members": 4,
      "rates": [
        {
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "default_duration": "P1Y",
          "notice_period": "P1M",
          "private": true
        }
      ],
      "revenue_schedule": "FREQ=WEEKLY"
    }
  }
}

Changes