Delete unpaid memberships for a member

DELETE /api/members/{memberId}/memberships/unpaid

Success: 200 OK

Overview

Abandons a membership purchase that was never paid for. Use it when a member starts a join or renewal, an invoice is raised, and payment is then abandoned — the half-finished records would otherwise sit against the member forever and confuse later purchases.

A membership is removed only if both of these hold:

Anything with money against it is left completely alone. The call is therefore safe to make speculatively, but it is not selective: you cannot name a particular membership, so every unpaid membership the member holds is removed in one go.

For each membership that qualifies, the endpoint deletes the membership, its sales invoice and invoice lines, any discount products attached to the membership, and the matching unpaid items in the member's basket. It then updates the member's own record and adds entries to the member's event log for the change. The deletion is not reversible through the API — the member has to buy the membership again.

The call returns 200 OK even when nothing was deleted, so the status code alone tells you nothing about what happened. Read paidMembershipsAreOutstanding to find out whether paid memberships were left behind.

One quirk worth knowing before you parse the response: it is a single JSON object, not an array, even though the field paths below are written with a leading [].

Endpoint

DELETE {base_url}/api/members/{memberId}/memberships/unpaid

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Path parameters

NameTypeRequiredDescription
memberIdinteger (int32)YesThe member whose unpaid memberships are removed. Must be greater than 0; 0 (non-member) and -999 (purged member) are rejected with 400. With a member-scoped token you may pass either your own id or that of a member linked to you — but a secondary member cannot pass the id of their primary member, which is rejected with 403.

Sample request

cURL
curl -X DELETE '{base_url}/api/members/{memberId}/memberships/unpaid' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'

Response fields

FieldTypeDescription
[].paidMembershipsAreOutstandingbooleantrue when the member still has at least one membership invoice with a receipt allocated against it — that is, memberships that were paid for, in full or in part, and so were deliberately not deleted. Use it to decide whether the member is now left with nothing (false) or still holds paid memberships you must account for (true). It is not a success flag: false is also what you get when the member had no membership records at all, and it says nothing about how many unpaid memberships were removed.

Sample response

200 OK
[
  {
    "paidMembershipsAreOutstanding": true
  }
]

Errors

StatusMeaningWhen
400Bad requestmemberId is 0 or negative. The body is {memberId} is an invalid member ID.
401UnauthorizedThe endpoint itself does not return this. In practice a 401 means your access token was missing, expired or rejected before the request was processed — see Authenticating with Gladstone APIs.
403ForbiddenYour token is for a secondary member and memberId is their primary member. The body is The linked member cannot modify records for their primary member. The relationship is one-way: a primary member may act on a linked member, but not the reverse.
403ForbiddenYour token is for a member who is neither memberId nor linked to them. The body is The given member ID of {memberId} does not belong to the logged in member nor any linked members.
404Not foundmemberId does not exist. The body is The given member could not be found. A member who exists but has no memberships returns 200, not 404.
500Internal server errorAn unexpected server-side failure while reading or deleting the membership records. Because the deletions are applied together, a failure part-way leaves the member's memberships as they were.

This page as markdown · All pages · llms.txt