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": "bdbcf3ee-1614-1203-6410-31cb98b163f1",
    "attention_reason": "site_id",
    "basket_id": "69c137a6ccfa190146000229",
    "end_date": "1934-02-05T02:41:12.0Z",
    "external_ref": "fugiat aliqua",
    "members": [
      {
        "customer_id": "4ed2e9bf-754a-baa1-a71f-6ede12a7c721",
        "is_lead": true,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "50c01a91-0386-2431-4aea-fa966f8a6bb5",
        "is_lead": false,
        "membership_number": "1234567890"
      },
      {
        "customer_id": "c577d721-3f79-1895-da2d-23189961daf8",
        "is_lead": false,
        "membership_number": "1234567890"
      }
    ],
    "membership_number": "1234567890",
    "next_billing_date": "1927-09-20T01:35:26.0Z",
    "payment_method": {
      "id": "esse",
      "type": "card",
      "last_4": "ipsum eu sint",
      "status": "revoked",
      "card_brand": "amex"
    },
    "rate": {
      "id": "04d465aa-afda-c5c7-4dca-e8b96e29da37",
      "membership_type_id": "96a52045-e12f-3c9f-51ab-c09b8f399f3e",
      "name": "Standard rate",
      "currency": "GBP",
      "price": 5000,
      "joining_fee": 1000,
      "billing_frequency": "P1M",
      "processors": [
        "do tempor"
      ],
      "default_duration": "P1Y",
      "private": true,
      "created_at": "1946-06-15T01:40:47.0Z",
      "updated_at": "1936-11-08T15:01:45.0Z"
    },
    "site_id": "edd3435a-3841-86d9-5402-69fb4672ad0b",
    "source": "unknown",
    "start_date": "1958-09-22T08:44:02.0Z",
    "status": "expired",
    "status_updated_at": "1930-08-26T01:32:44.0Z",
    "type": {
      "id": "bfee0abe-62d8-a71a-21e2-e73181c7f4fb",
      "name": "Gold tier",
      "description": "Enjoy exclusive benefits as part of being a member in our Gold tier",
      "terms": "nisi sunt",
      "brand_id": "4625cc7d-18e8-805b-a65f-0145311b1b72",
      "offline_payments": false,
      "disable_confirmation_email": false,
      "private": false,
      "visibility": "link_only",
      "minimum_start_date": "1920-03-11T16:15:39.0Z",
      "min_members": 2,
      "max_members": 4,
      "rates": [],
      "revenue_schedule": "FREQ=WEEKLY",
      "created_at": "1892-02-27T13:41:07.0Z",
      "updated_at": "1908-10-04T04:38:13.0Z",
      "deleted_at": "1925-04-14T05:40:10.0Z"
    },
    "created_at": "1922-04-03T04:26:51.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": "a9fb76f6-e52c-8c20-2aea-977d6915a5d1",
    "membership": {
      "id": "910940f6-fd74-0428-2c48-cccb5aa04c90",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "cb205568-bbed-86cd-8c22-c2eefd6a84fe",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "last_4": 4001,
      "processor_type": "Cash",
      "processor_type_id": "69c137a8ccfa1901460007a9"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "in",
    "can_download_receipt": true,
    "amount_refunded": -66642702,
    "refunded": false,
    "refunds": [
      {
        "id": "893fbd8d-551b-e11a-732b-0392a8785f4e",
        "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": "1912-07-06T16:50:21.0Z",
        "updated_at": "1914-09-16T05:04:33.0Z"
      },
      {
        "id": "9ef9a86f-c891-bad9-dc96-acb3643b791b",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1902-08-13T15:09:49.0Z",
        "updated_at": "1966-05-21T02:01:22.0Z"
      },
      {
        "id": "0d4354d2-87b7-4b25-e4fa-20862ec0abfc",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "06b85a21-850b-606f-36b7-f370eb7f71e9",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1944-11-21T18:26:13.0Z",
        "updated_at": "1964-06-18T21:27:39.0Z"
      },
      {
        "id": "5e465298-c54e-090b-0165-433136327450",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "04f182ee-e50e-f231-dc0f-ba174c9485b0",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1932-09-24T01:01:10.0Z",
        "updated_at": "1966-07-19T17:58:38.0Z"
      },
      {
        "id": "c01bae1b-11f3-3ac1-a085-3f9612f1ae05",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "f40714f6-4c04-658a-7ea3-a369da1875cc",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1914-07-12T09:10:04.0Z",
        "updated_at": "1917-04-20T01:28:45.0Z"
      }
    ],
    "site_id": "0f984796-7f47-5797-430d-2111895574e1",
    "billing_period_from": "1951-02-11",
    "billing_period_to": "1942-02-02",
    "processing_at": "1960-09-29T22:54:52.0Z",
    "created_at": "1934-02-01T15:36:50.0Z",
    "updated_at": "1909-05-12T20:29:20.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": "49be4f2e-6202-a849-35d5-6586e44dc245",
    "membership": {
      "id": "b38e7df4-9f47-3aa6-e117-23833b84659c",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "83b776a4-d0df-bad3-4d48-ac33070282fa",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001,
      "processor_type": "Cash",
      "processor_type_id": "69c137a6ccfa19014600022a"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "do in",
    "can_download_receipt": true,
    "amount_refunded": 40961930,
    "refunded": true,
    "refunds": [
      {
        "id": "e63e2bb6-b4d7-5e3f-24d1-02d760791d90",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "caa0a246-2d0a-4c80-b96f-a6bcb0753f93",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1927-04-23T16:58:04.0Z",
        "updated_at": "1942-11-03T02:29:44.0Z"
      }
    ],
    "site_id": "a7630464-5c3f-56f9-a0f5-c126a9ce26ac",
    "billing_period_from": "1954-11-23",
    "billing_period_to": "1945-02-19",
    "processing_at": "1941-03-09T17:37:31.0Z",
    "created_at": "1954-06-01T21:27:39.0Z",
    "updated_at": "1913-10-23T12:40:38.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": "2fb96713-52dd-89a2-01e3-22a40a2cef21",
    "membership": {
      "id": "6cafc09e-8b6a-c9cc-5199-513254513ab5",
      "membership_number": "00000014",
      "type_name": "Gold Membership",
      "customer_id": "d0437e17-0e68-5cfc-5350-e721ad267ee4",
      "customer_name": "Jane Jones"
    },
    "processor": "adyen",
    "processor_data": {
      "cardholder_name": "Mrs J Jones",
      "last_4": 4001,
      "processor_type_id": "69c137a6ccfa19014600022b"
    },
    "amount": 3995,
    "original_amount": 3995,
    "currency": "gbp",
    "tax": 1000,
    "status": "succeeded",
    "description": "do ea quis pariatur consectetur",
    "can_download_receipt": true,
    "amount_refunded": 69936301,
    "refunded": false,
    "refunds": [
      {
        "id": "023673b6-cdea-6f59-f607-57c5c9501880",
        "status": "succeeded",
        "amount": 995,
        "currency": "gbp",
        "notes": "Gesture of good will",
        "failure_reason": "invalid_details",
        "refunded_by": {
          "id": "331e746c-5a2c-6f99-4d62-ba4c0b21abb0",
          "full_name": "Jane Jenkins"
        },
        "processor_data": {
          "processor": "adyen",
          "processor_id": "re_64301e0b2df9d11814010ea6"
        },
        "created_at": "1949-10-08T11:13:11.0Z",
        "updated_at": "1969-05-08T17:45:27.0Z"
      }
    ],
    "site_id": "ff509cc4-7545-3871-ec40-30caf4b87578",
    "billing_period_from": "1925-02-11",
    "billing_period_to": "1905-11-15",
    "processing_at": "1922-07-30T07:32:35.0Z",
    "created_at": "1933-05-09T11:59:27.0Z",
    "updated_at": "1936-12-12T22:50:14.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": "69c137a8ccfa1901460007aa",
    "organisation_id": "14396dc9-dad4-bc0c-d536-e187dee15883",
    "site_id": "452440a4-c0a0-dbf1-62e9-f47b353b3057",
    "customer_id": "cb863b92-a45d-fce1-afe6-94bde10f07c8",
    "membership_id": "4fe49f33-2d1a-7278-c17f-f3a4eb89280b",
    "from": "Trybe",
    "to": "+447123456789",
    "message": "labore aliquip",
    "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": {
    "amet944": [
      "Lorem nulla in ea",
      "Duis nostrud esse",
      "enim",
      "in fugiat Duis tempor sunt"
    ],
    "fugiatff": [
      "dolor esse amet officia",
      "mollit veniam",
      "in anim dolore",
      "minim culpa do eiusmod",
      "exercitation reprehenderit sit officia"
    ]
  },
  "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": "a6834aba-6284-dc38-872f-a619c24332e1",
    "organisation_id": "6b4aaf9b-e7d9-1214-3ba8-ed568bc8c846"
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}