Memberships

A Membership represents a membership belonging to one or more Customers.

Schema

Attributes

  • The ID of the membership

  • The ID of the site this membership belongs to

  • The unique membership number of the lead member. This is always a 10 digit numeric string. Since this field only relates to the lead member, this is now deprecated. Instead, find the membership for the relevant customer in the members array.

  • Possible values are active, needs_dd_mandate, needs_attention, reserved, inactive, expired and upcoming

  • Where the membership was created

    Possible values are self_signup, app, import and unknown

  • Details about the payment method attached to this membership. This payment method is used to take payment on the monthly billing period. If a payment method hasn't been set up, this will be null.

  • The date which the membership starts

  • The date which the membership ends

  • The datetime which the membership was created

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

  • An external reference for this membership.

  • The date which the membership will next be billed

  • next_charge
    Nullable

    A summary of the next charge that's due for this membership.

    This property is only populated when the membership was retrieved using the `getCustomerMemberships endpoint.

  • A string describing what kind of action needs to take place

    Possible values are no_mandate, setup_unpaid, mandate_revoked, payment_failed, payment_disputed, payment_outstanding and site_id

""
listMemberships

List Memberships

This endpoint lists the Memberships which are associated to the provided site.

Query parameters

  • Filters memberships belonging to the specified customer

  • page
    Optional

    The page to retrieve results from

  • per_page
    Optional

    The number of results to return per page

Responses

  • 200

    The Memberships were successfully retrieved

GET/customers/memberships
200
example response
{
  "data": [],
  "meta": {
    "from": 1,
    "to": 2,
    "total": 2,
    "current_page": 1,
    "last_page": 2,
    "per_page": 15,
    "path": "http://example.com/api"
  },
  "links": {
    "first": "http://example.com?page=1",
    "next": "https://example.com?page=3",
    "prev": "https://example.com?page=1",
    "last": "https://example.com?page=4"
  }
}
getMembership

Show a membership

Use this endpoint to retrieve a Membership by its ID.

Path parameters

Responses

  • 200

    The Membership was successfully retrieved

  • 404

    The resource couldn't be found

GET/customers/memberships/{membershipId}
200
example response
{
  "data": {
    "customer": {
      "id": "8e0342ed-b4a0-3097-2dbc-107e30f9f0f6",
      "first_name": "Jane",
      "last_name": "Doe",
      "full_name": "Jane Doe",
      "phone": "+447900000000",
      "has_password": true,
      "dob": "1949-08-22",
      "brand_id": "0ef6e6f4-189a-e230-b854-fdb7adb5f519",
      "site_id": "eeb2e9b3-5a07-14c8-b7f8-aaf3b9187484",
      "stripe_id": "cus_1234567890",
      "express_stripe_id": "cus_1234567890",
      "email": "janedoe@example.com",
      "labels": [
        {
          "id": "d58a47ae-4733-bf0d-67d6-2a2cdc00d4d2",
          "value": "VIP",
          "colour": "ff6634"
        },
        {
          "id": "c87299d0-3482-9d40-a78b-0f123ac02665",
          "value": "VIP",
          "colour": "ff6634"
        }
      ],
      "preferred_locale": "en",
      "locked_at": "1924-07-05T11:46:01.0Z",
      "created_at": "1906-06-01T22:22:32.0Z",
      "updated_at": "1914-10-31T04:01:14.0Z",
      "deleted_at": "1914-05-14T10:24:52.0Z",
      "last_active_at": "1951-06-19T02:23:49.0Z",
      "email_verified_at": "1919-10-06T01:08:58.0Z",
      "last_check_in": {
        "checked_in_at": "1934-08-03T15:59:52.0Z",
        "method": "Scanned"
      },
      "avatar_id": "000000-000000-000000-000000",
      "avatar": {
        "id": "e22a87e8-a056-c5bc-8eb3-d8f1ab9c9e77",
        "file_name": "super-cool-photo.jpg",
        "mime_type": "image/jpeg",
        "size": 84256,
        "url": "https://example.com/media/super-cool-photo.jpg"
      },
      "external_ref": "commodo eu Lorem non"
    },
    "members": [],
    "source": "unknown",
    "start_date": "1912-11-05T14:16:37.0Z",
    "end_date": "1931-02-06T16:34:08.0Z",
    "external_ref": "minim non tempor sunt",
    "next_charge": {
      "id": "2dd1e260-b9b2-564b-6f0d-3cdf2db9e917",
      "amount": 3995,
      "currency": "GBP",
      "status": "errored",
      "billing_period_from": "1940-01-03",
      "billing_period_to": "1956-02-03"
    }
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
actionAddMembershipChargePayment

Record a manual payment against a charge

This endpoint allows a manual (off-Trybe) payment to be recorded against a membership charge.

Path parameters

Request body

  • The ID of the custom payment type this payment should be recorded as

  • amount
    Required

    The amount of the payment

Responses

  • 200

    A charge against a membership.

  • 404

    The resource couldn't be found

POST/shop/memberships/{membershipId}/charges/{chargeId}/payment
200
example response
{
  "data": {
    "id": "9d77a5d7-5a7f-5e73-b2d7-36c6aeae2d23",
    "membership": {
      "id": "898f97a6-8f2c-af4b-a2cf-e3b0b8b22c64",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "b945b7cc-3a36-ab2c-9286-a35f8d44a76e"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001,
      "processor_type": "Cash"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "can_download_receipt": false,
    "amount_refunded": "aliquip amet laboris voluptate",
    "refunded": "proident amet ut velit eu",
    "refunds": [
      {
        "id": "ffec9000-bf89-d3e0-084e-bb8b8ece3647",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "d1b6c974-a1b3-7045-55a7-54ce56419b29",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1931-12-17T01:14:19.0Z",
        "updated_at": "1962-10-07T01:26:15.0Z"
      },
      {
        "id": "87764ee5-247d-6058-a329-65826e7e631e",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "d515d878-c0d9-35d5-c656-3b3a0efb7d7d",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1891-11-24T15:33:40.0Z",
        "updated_at": "1909-04-03T03:15:29.0Z"
      }
    ],
    "site_id": "50595bf7-9c55-1cfc-0e38-3410110c9ac5",
    "billing_period_from": "1953-04-01",
    "billing_period_to": "1933-03-16",
    "created_at": "1900-12-21T23:24:11.0Z",
    "updated_at": "1890-07-29T02:10:01.0Z"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}