Memberships

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

Schema

Attributes

  • The ID of the membership

  • 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

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

  • end_date
    Nullable

    The date which the membership ends

  • An external reference for this membership.

  • 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.

  • 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.

  • 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 ID of the site this membership belongs to

  • Where the membership was created

    Possible values are self_signup, app, import and unknown

  • The date which the membership starts

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

  • A URL to a page where the member can provide their payment details.

  • The datetime which the membership was created

""
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": {
    "id": "15fc0d33-554d-7ead-30f3-a8cf2fcf828b",
    "attention_reason": "payment_failed",
    "basket_id": "69bbd23aa850d9015000021e",
    "customer": {
      "id": "87e7e041-bff3-4cab-dccc-d22f0cfd8ecf",
      "first_name": "Jane",
      "last_name": "Doe",
      "full_name": "Jane Doe",
      "phone": "+447900000000",
      "has_password": true,
      "dob": "1908-07-20",
      "brand_id": "d6a9e673-f698-3f56-12c8-e18a56378db9",
      "site_id": "e7b9fbae-0c45-6c3d-24d4-4d73fc2911ee",
      "stripe_id": "cus_1234567890",
      "express_stripe_id": "cus_1234567890",
      "email": "janedoe@example.com",
      "labels": [
        {
          "id": "e1d405e3-fc62-4174-c544-48c847012996",
          "value": "VIP",
          "colour": "ff6634"
        },
        {
          "id": "584d19dd-8810-9d01-1815-79290b2e20c9",
          "value": "VIP",
          "colour": "ff6634"
        },
        {
          "id": "1c0b8fb1-444d-8966-e630-c00e8ebbdb0e",
          "value": "VIP",
          "colour": "ff6634"
        }
      ],
      "preferred_locale": "en",
      "locked_at": "1922-12-20T10:14:25.0Z",
      "created_at": "1923-02-01T06:22:32.0Z",
      "updated_at": "1904-03-05T03:55:19.0Z",
      "deleted_at": "1948-06-16T03:58:56.0Z",
      "last_active_at": "1953-03-27T17:26:23.0Z",
      "email_verified_at": "1932-01-09T04:34:02.0Z",
      "last_check_in": {
        "checked_in_at": "1935-03-25T04:23:57.0Z",
        "method": "Scanned"
      },
      "avatar_id": "000000-000000-000000-000000",
      "avatar": {
        "id": "a288ce4a-4e8f-a316-ff9a-e236be368d68",
        "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": "quis cillum"
    },
    "end_date": "1929-02-27T20:56:59.0Z",
    "external_ref": "cillum",
    "members": [
      {
        "customer_id": "4a8768eb-3e4d-4780-8d88-45ddaefdfb9e",
        "is_lead": true,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "927f0cc2-3d73-9e03-f301-01d2916b48dd",
        "is_lead": false,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "bd37ead9-cadf-1570-df02-95bf4ddf32c9",
        "is_lead": false,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "4c49567e-5aae-8da8-9111-c75d26753b5c",
        "is_lead": true,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "0f84e830-d6f9-e586-6f0a-115c6d4a693e",
        "is_lead": false,
        "membership_number": "1234567890"
      }
    ],
    "membership_number": "1234567890",
    "next_billing_date": "1895-06-08T06:37:05.0Z",
    "next_charge": {
      "id": "699acbe9-74eb-483b-2033-577a4edfd6ed",
      "amount": 3995,
      "currency": "GBP",
      "status": "errored",
      "billing_period_from": "1957-05-04",
      "billing_period_to": "1926-09-19"
    },
    "payment_method": {
      "id": "pariatur sunt minim",
      "type": "card",
      "status": "revoked",
      "card_brand": "amex"
    },
    "rate": {
      "id": "1df90fe0-f19f-6b2a-1d19-f3285172a795",
      "membership_type_id": "431d3d1d-be52-01e2-20d3-4af7d7433784",
      "name": "Standard rate",
      "currency": "GBP",
      "price": 5000,
      "joining_fee": 1000,
      "billing_frequency": "P1M",
      "processors": [
        "Ut"
      ],
      "default_duration": "P1Y",
      "private": true,
      "created_at": "1905-12-31T01:16:23.0Z",
      "updated_at": "1899-08-12T21:04:03.0Z"
    },
    "site_id": "6a252e37-b59c-c2af-3a99-33c39a1683cd",
    "source": "app",
    "start_date": "1936-04-05T20:23:31.0Z",
    "status": "active",
    "status_updated_at": "1935-03-14T01:53:43.0Z",
    "type": {
      "id": "9867a1ca-872c-62f5-b4bf-540aa51c6cc2",
      "name": "Gold tier",
      "description": "Enjoy exclusive benefits as part of being a member in our Gold tier",
      "terms": "fugiat elit nostrud mollit officia",
      "brand_id": "7e9b10f5-42be-31f2-7bb5-804a279abbce",
      "offline_payments": false,
      "disable_confirmation_email": true,
      "private": true,
      "visibility": "link_only",
      "minimum_start_date": "1904-04-28T01:47:42.0Z",
      "min_members": 2,
      "max_members": 4,
      "rates": [
        {
          "id": "2347ea47-c160-56f1-1439-0ffec970937b",
          "membership_type_id": "52f23019-a8c7-281b-913c-623218fa3f1d",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [
            "reprehenderit",
            "labore consequat ullamco"
          ],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1891-05-05T20:05:21.0Z",
          "updated_at": "1940-04-18T16:55:14.0Z"
        },
        {
          "id": "877f27ff-000a-3aef-9194-4df8aa8722d1",
          "membership_type_id": "ebf614f4-829e-d3fd-1194-b7d728d1e0ab",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [
            "reprehenderit dolore Lorem cillum laboris"
          ],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1894-10-09T08:49:52.0Z",
          "updated_at": "1914-07-08T03:56:56.0Z"
        },
        {
          "id": "1070201a-27b3-8884-a196-cfb3bd9ec645",
          "membership_type_id": "b87e5287-91f3-a506-a7f9-c1d2b32e62ce",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1895-06-20T09:09:01.0Z",
          "updated_at": "1897-02-09T21:21:15.0Z"
        }
      ],
      "revenue_schedule": "FREQ=WEEKLY",
      "created_at": "1924-02-11T13:33:04.0Z",
      "updated_at": "1954-11-02T15:40:43.0Z",
      "deleted_at": "1950-11-06T07:17:48.0Z"
    },
    "payment_details_url": "consequat proident ad",
    "created_at": "1964-06-01T22:38:37.0Z"
  }
}
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
    Nullable

    The amount of the payment

Responses

  • 200

    A charge against a membership.

  • 404

    The resource couldn't be found

POST/shop/membership-charges/{chargeId}/payment
200
example response
{
  "data": {
    "id": "5a99666c-8eca-dc17-5583-2484d22a377e",
    "membership": {
      "id": "40ee3520-f457-f9b7-25a4-c079e8f37b9d",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "c397dd23-410d-2c35-edcf-87c47773695d",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "processor_type": "Cash",
      "processor_type_id": "69bbd23ba850d9015000021f"
    },
    "amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "exercitation in esse cupidatat",
    "can_download_receipt": true,
    "amount_refunded": -89613422,
    "refunded": true,
    "refunds": [
      {
        "id": "a8eaae84-b5ff-2579-df65-4d14136762f4",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "e23d990a-6ca0-5913-e123-e2fa903fb31c",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1890-07-06T20:19:03.0Z",
        "updated_at": "1938-04-06T16:50:43.0Z"
      },
      {
        "id": "53a225bb-36a0-30e7-b2b0-1037ab8d3d06",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "0d95ebdf-e7a0-8b87-5370-5f2cef2e7bb2",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1964-02-08T15:09:57.0Z",
        "updated_at": "1890-01-24T19:27:32.0Z"
      },
      {
        "id": "fca0da47-5953-c38f-8e72-21c9c7fac874",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "refunded_by": {
          "id": "be5f8289-8f44-bcf1-6cc3-0e6f7a10b7c9",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1896-07-23T21:43:44.0Z",
        "updated_at": "1904-06-09T07:17:57.0Z"
      }
    ],
    "site_id": "6e50aa3d-7f38-b6ee-dca7-196f1b413b0a",
    "billing_period_from": "1953-11-05",
    "billing_period_to": "1926-05-02",
    "processing_at": "1936-03-14T04:30:36.0Z",
    "created_at": "1965-07-01T08:21:44.0Z",
    "updated_at": "1925-09-08T06:37:09.0Z"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
actionProcessMembershipCharge

Manually process a charge for a membership

This endpoint allows a membership charge to be processed manually.

Path parameters

Responses

  • 200

    A charge against a membership.

  • 404

    The resource couldn't be found

POST/shop/membership-charges/{chargeId}/process
200
example response
{
  "data": {
    "id": "72d9cbba-6f6f-348d-5e29-d77815df9a4a",
    "membership": {
      "id": "fe218488-bd1b-4d04-8380-fd754933602b",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "af1309f3-3c40-fc3f-f673-21e593adbff1",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {},
    "amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "proident sunt eiusmod",
    "can_download_receipt": false,
    "amount_refunded": -59863645,
    "refunded": false,
    "refunds": [],
    "site_id": "1bb41824-94d2-3976-8b94-f14e41ddd9d2",
    "billing_period_from": "1935-08-30",
    "billing_period_to": "1919-12-05",
    "created_at": "1957-03-28T04:35:14.0Z",
    "updated_at": "1922-09-19T11:01:15.0Z"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
actionRetryMembershipCharge

Manually retry a charge for a membership

This endpoint allows a membership charge to be retried manually.

Path parameters

Responses

  • 200

    A charge against a membership.

  • 404

    The resource couldn't be found

POST/shop/membership-charges/{chargeId}/retry
200
example response
{
  "data": {
    "id": "b6fd0f8b-f145-19af-6180-0837652cb7f9",
    "membership": {
      "id": "a93e4129-ac1c-b79a-9975-fe7e41eb9f2a",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "14eb85b5-e9e5-9948-04f4-69d6fbfccd4a"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "enim Excepteur elit ipsum ullamco",
    "can_download_receipt": true,
    "amount_refunded": 86627321,
    "refunded": false,
    "refunds": [
      {
        "id": "7f44803c-3c3a-6512-5a6e-3b5c40793da2",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "21fb9960-062d-4d61-4003-f41b57b3dab6",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1965-09-03T04:39:24.0Z",
        "updated_at": "1919-05-28T07:30:14.0Z"
      },
      {
        "id": "b7f78067-b4ff-48c9-9fe3-1023466cf38e",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "7969c3a4-1f16-dfb0-af9d-c4cbc3e2641e",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1897-12-27T09:03:59.0Z",
        "updated_at": "1959-07-10T21:41:38.0Z"
      }
    ],
    "site_id": "0f161236-359e-375a-168b-156348ffbc34",
    "billing_period_from": "1941-05-28",
    "billing_period_to": "1913-04-18",
    "processing_at": "1917-05-17T22:55:42.0Z",
    "created_at": "1942-07-27T06:56:27.0Z",
    "updated_at": "1892-12-07T11:49:21.0Z"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
createMembershipSms

Send an SMS message for a membership

This endpoint sends an SMS message to a membership's lead member. Currently supports sending billing details request messages.

Path parameters

Request body

  • message_type
    Required

    The type of message to send.

    Possible values are billing_details_request

  • If true, send the SMS even if the membership already has a payment method. Defaults to false.

Responses

  • 200

    The SMS message was successfully sent

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

POST/shop/memberships/{membershipId}/sms
200
example response
{
  "data": {
    "id": "69bbd23ba850d90150000220",
    "organisation_id": "79c2b279-ef56-1be1-5763-393f4f7f0ef6",
    "site_id": "5fae029c-d80f-3343-1d5b-39a80d954434",
    "customer_id": "4c765101-e379-7ab0-a257-219e2bf233af",
    "membership_id": "b4dd1805-34f4-5245-dfd1-a823a592ddd0",
    "from": "Trybe",
    "to": "+447123456789",
    "message": "culpa labore aute sed",
    "message_type": "billing_details_request",
    "message_delivered": true,
    "created_at": "2024-02-02T12:01:01.0Z",
    "sent_at": "2024-02-02T12:01:01.0Z"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
422
example response
{
  "errors": {
    "sint_c3e": [],
    "Ut5": [
      "ipsum fugiat aute dolore tempor",
      "sint aliquip laboris ut",
      "laborum mollit"
    ]
  },
  "message": "The request didn't pass validation"
}
createMembershipSmsPreview

Preview an SMS message for a membership

This endpoint previews an SMS message for a membership.

Path parameters

Request body

  • message_type
    Required

    The type of the SMS message.

    Possible values are billing_details_request

  • If true, preview the SMS even if the membership already has a payment method. Defaults to false.

Responses

  • 200

    The preview of the SMS message was successfully retrieved

  • 404

    The resource couldn't be found

POST/shop/memberships/{membershipId}/sms/preview
200
example response
{
  "data": {
    "message": "Your Premium Membership membership is almost ready! Please provide payment details for your membership payments. Set up here: https://example.com/confirm\n",
    "site_id": "1797ba29-da5b-0287-fbfd-483e1b0c409c",
    "organisation_id": "31b5c91e-fbe0-ef5a-6de1-572408a82053"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}