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": "3ff21844-2a5b-2e59-bdbc-72fb98de48cc",
    "attention_reason": "payment_outstanding",
    "basket_id": "698e0141265123013d000091",
    "customer": {
      "id": "27615076-929f-e7ea-6b2a-a09d63113952",
      "first_name": "Jane",
      "last_name": "Doe",
      "full_name": "Jane Doe",
      "phone": "+447900000000",
      "has_password": true,
      "dob": "1937-06-16",
      "brand_id": "b38c400f-4834-fe8e-621d-0f1ef09290e3",
      "site_id": "502e8d87-ee4d-39c1-3e28-21d8e5b6f6ae",
      "stripe_id": "cus_1234567890",
      "express_stripe_id": "cus_1234567890",
      "email": "janedoe@example.com",
      "labels": [
        {
          "id": "bfddeeb9-23a3-f654-1c09-1f889b0ad0fb",
          "value": "VIP",
          "colour": "ff6634"
        },
        {
          "id": "51365e8b-57c1-93a3-556c-3d7feb6906bc",
          "value": "VIP",
          "colour": "ff6634"
        }
      ],
      "preferred_locale": "en",
      "locked_at": "1969-11-17T14:04:24.0Z",
      "created_at": "1954-03-19T04:05:57.0Z",
      "updated_at": "1919-08-21T10:12:56.0Z",
      "deleted_at": "1951-11-02T04:29:36.0Z",
      "last_active_at": "1969-01-28T21:03:46.0Z",
      "email_verified_at": "1898-06-20T03:01:03.0Z",
      "last_check_in": {
        "checked_in_at": "1938-07-27T23:01:25.0Z",
        "method": "Scanned"
      },
      "avatar_id": "000000-000000-000000-000000",
      "avatar": {
        "id": "602b480e-7b04-ad36-e154-64be0731c3fa",
        "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": "nulla dolore"
    },
    "end_date": "1897-10-07T19:43:44.0Z",
    "external_ref": "dolore non ut nisi",
    "members": [],
    "membership_number": "1234567890",
    "next_billing_date": "1918-04-23T19:20:06.0Z",
    "next_charge": {
      "id": "5d22949d-a357-8beb-3f14-125e61527119",
      "amount": 3995,
      "currency": "GBP",
      "status": "awaiting_approval",
      "billing_period_from": "1915-11-01",
      "billing_period_to": "1909-09-27"
    },
    "payment_method": {
      "id": "veniam",
      "type": "direct_debit",
      "status": "revoked",
      "card_brand": "amex"
    },
    "rate": {
      "id": "509b804c-9519-5e16-2ae9-f1426db738a4",
      "membership_type_id": "aeb0f2e6-fa30-96c4-dfec-9d59a241289b",
      "name": "Standard rate",
      "currency": "GBP",
      "price": 5000,
      "joining_fee": 1000,
      "billing_frequency": "P1M",
      "processors": [
        "tempor in",
        "dolore irure magna dolor",
        "sint ullamco aute",
        "eu id cupidatat"
      ],
      "default_duration": "P1Y",
      "private": true,
      "created_at": "1946-09-08T23:18:45.0Z",
      "updated_at": "1916-11-04T09:58:42.0Z"
    },
    "site_id": "6047a9d2-3063-2cf3-305a-eca8d1eb79f5",
    "source": "self_signup",
    "start_date": "1953-11-16T05:21:39.0Z",
    "status": "active",
    "status_updated_at": "1904-04-03T05:37:28.0Z",
    "type": {
      "id": "a4aa512c-ea5f-7de2-fb83-0a248cc264e4",
      "name": "Gold tier",
      "description": "Enjoy exclusive benefits as part of being a member in our Gold tier",
      "terms": "minim",
      "brand_id": "e0ab0adb-5f45-e279-b7be-bc13e380cc1b",
      "offline_payments": true,
      "disable_confirmation_email": true,
      "private": false,
      "visibility": "public",
      "minimum_start_date": "1891-07-03T23:39:08.0Z",
      "min_members": 2,
      "max_members": 4,
      "rates": [
        {
          "id": "9d3443f2-8e33-7bd3-9d8c-bdb4dca69300",
          "membership_type_id": "20c2c1d3-cbbf-81a0-9796-1a2b7ed79cb2",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [
            "incididunt",
            "ad",
            "occaecat",
            "aliquip occaecat"
          ],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1895-12-01T03:16:14.0Z",
          "updated_at": "1966-07-07T17:26:41.0Z"
        },
        {
          "id": "13a073bf-4cc1-9564-a6d2-ab1fe98fa8b7",
          "membership_type_id": "177a9597-8058-bb90-2c7a-937a76bae1ed",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [
            "nisi mollit"
          ],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1952-12-13T07:22:26.0Z",
          "updated_at": "1942-02-25T19:44:42.0Z"
        },
        {
          "id": "e293651e-8d70-40d1-6b10-46fa866f1fc9",
          "membership_type_id": "c72d542e-a103-266f-a8d9-2e18f3348298",
          "name": "Standard rate",
          "currency": "GBP",
          "price": 5000,
          "joining_fee": 1000,
          "billing_frequency": "P1M",
          "processors": [
            "ut proident sint",
            "incididunt Duis et",
            "labore",
            "voluptate elit"
          ],
          "default_duration": "P1Y",
          "private": true,
          "created_at": "1948-06-09T01:28:31.0Z",
          "updated_at": "1946-01-10T09:30:12.0Z"
        }
      ],
      "revenue_schedule": "FREQ=WEEKLY",
      "created_at": "1924-01-05T17:44:23.0Z",
      "updated_at": "1930-10-01T23:05:57.0Z",
      "deleted_at": "1947-04-08T02:44:10.0Z"
    },
    "payment_details_url": "do",
    "created_at": "1893-10-31T03:08:22.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": "b5908b01-cba7-d345-4608-f0f976977d3c",
    "membership": {
      "id": "c185e02c-ce13-c8bd-51d7-a8ff066e2393",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "ef10fac5-8765-55bc-22a9-b3b435fb1a05"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001,
      "processor_type": "Cash",
      "processor_type_id": "698e0141265123013d000095"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "in est in ipsum",
    "can_download_receipt": false,
    "amount_refunded": 88659579,
    "refunded": false,
    "refunds": [
      {
        "id": "5a07561e-c237-9934-8aa4-6165286da9b9",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1929-05-07T05:03:34.0Z",
        "updated_at": "1948-10-15T21:57:53.0Z"
      },
      {
        "id": "9405de55-f457-364e-95e4-eb66d456221f",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "51eda51f-6f92-d2b2-a6a8-505acbcc4eff",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1959-02-18T06:06:56.0Z",
        "updated_at": "1927-06-07T05:59:25.0Z"
      }
    ],
    "site_id": "26a43638-87c1-c7f0-05c9-7a35fb222e4c",
    "billing_period_from": "1922-06-17",
    "billing_period_to": "1968-11-25",
    "processing_at": "1926-09-05T01:12:24.0Z",
    "created_at": "1912-07-26T22:22:20.0Z",
    "updated_at": "1966-06-24T01:27:33.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": "18659bdc-5ead-02b4-969d-b2ef02327d9b",
    "membership": {
      "id": "0b435c64-b900-b31e-c586-fb6d827edb09",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "7c9aea27-704b-d6c6-458b-0730fdd2ead4",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001,
      "processor_type": "Cash",
      "processor_type_id": "698e0141265123013d000092"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "pariatur eu",
    "can_download_receipt": true,
    "amount_refunded": -28707924,
    "refunded": false,
    "refunds": [
      {
        "id": "3986159f-b750-5de5-b4cc-5fdf20896a17",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "2e8ea93f-c7d4-e49f-dbc8-07790614d8de",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1902-12-28T01:07:11.0Z",
        "updated_at": "1966-05-25T09:44:11.0Z"
      },
      {
        "id": "0ed47264-69b5-4082-f773-1c011622832d",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "3ce3cd42-1634-5842-1a22-14c352eb8100",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1926-06-24T10:12:58.0Z",
        "updated_at": "1950-11-01T19:23:51.0Z"
      },
      {
        "id": "8554a75e-0a87-bbce-88d4-01b77c80663d",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "3e0db83d-13c1-b992-c6a6-ead726686792",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1960-12-15T07:53:42.0Z",
        "updated_at": "1951-11-14T04:48:04.0Z"
      },
      {
        "id": "aa8d918a-9818-c54c-c826-5f2123e57018",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "ab861028-95b6-da0d-2812-0b75dd7caead",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1902-04-23T21:07:34.0Z",
        "updated_at": "1916-12-25T16:44:27.0Z"
      },
      {
        "id": "ca9d9d7b-831c-6e57-e4fc-b627a948bbe7",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1915-12-27T09:02:32.0Z",
        "updated_at": "1920-10-04T21:51:21.0Z"
      }
    ],
    "site_id": "95703af2-d93e-c729-a083-6c5400271e5f",
    "billing_period_from": "1965-10-12",
    "billing_period_to": "1931-02-04",
    "processing_at": "1941-09-22T20:29:43.0Z",
    "created_at": "1922-05-11T17:08:39.0Z",
    "updated_at": "1897-06-23T19:59:39.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": "d5c6bd0b-9e95-5b07-c396-dfd8e9fa2487",
    "membership": {
      "id": "f8fb908a-990f-9b1b-0eac-6a6ac94884be",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "36a2c89c-ed8b-ca58-2e3b-3b980133a8af",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "processor_type_id": "698e0141265123013d000093"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "nisi nulla",
    "can_download_receipt": false,
    "amount_refunded": -90188064,
    "refunded": false,
    "refunds": [
      {
        "id": "4d56e40a-5377-91bd-77d3-882623940188",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "c7f6bbdb-8ee4-c89c-e68d-266dc18012ad",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1910-10-15T03:55:37.0Z",
        "updated_at": "1898-06-29T01:37:47.0Z"
      }
    ],
    "site_id": "f0403d40-1499-d609-1d33-5952531e3d46",
    "billing_period_from": "1912-04-22",
    "billing_period_to": "1919-06-18",
    "processing_at": "1898-05-27T11:51:15.0Z",
    "created_at": "1945-06-10T12:40:48.0Z",
    "updated_at": "1890-12-20T03:14:24.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": "698e0141265123013d000096",
    "organisation_id": "3141f151-5dd3-8953-25b8-604a98f9fa37",
    "site_id": "55215859-c7be-73d6-a8c0-3b0ac15ef09c",
    "customer_id": "9bb0680c-7f54-c926-7000-be6e1b517d6f",
    "membership_id": "b753b840-dbe4-e822-1cd6-08b5c3161c0a",
    "from": "Trybe",
    "to": "+447123456789",
    "message": "occaecat ut laborum et elit",
    "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": {
    "esse_776": [
      "proident ullamco cupidatat",
      "mollit magna"
    ]
  },
  "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": "9132223e-3902-db90-b947-15afc4e83755",
    "organisation_id": "3351a83f-5a0d-2127-3fef-a9d1fbc8356d"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}