Skip to main content
curl --request POST 'https://api.mayar.id/hl/v2/memberships/members/MBR8X2QK/cancel' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
    "productId": "7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f"
}'
{
    "statusCode": 200,
    "message": "success",
    "data": {
        "membershipCustomer": {
            "id": "c4d5e6f7-a8b9-4c0d-8e1f-2a3b4c5d6e7f",
            "memberId": "MBR8X2QK",
            "userId": "348e083d-315a-4e5c-96b1-5a2a98c48413",
            "customerId": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
            "membershipTierId": "9b2d4f6a-8c1e-4a3b-bd5c-6e7f8a9b0c1d",
            "paymentLinkId": "7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
            "monthlyPaymentPeriod": 1,
            "status": "stopped",
            "nextPayment": "2026-07-20T09:10:57.994Z",
            "expiredAt": null,
            "createdAt": "2026-06-20T09:10:57.994Z",
            "updatedAt": "2026-06-23T10:30:00.000Z"
        }
    }
}
Endpoint:
https://api.mayar.id/hl/v2/memberships/members/(memberId)/cancel

Authorization

Authorization
string
required
Example:Authorization | Bearer Paste-Your-API-Key-Here

Path Parameters

memberId
string
required
The public membership code of the member to cancel.Example:MBR8X2QK

Request Body

productId may be supplied in the request body OR as a query parameter (see Query Parameters). At least one location is required.
productId
string
required
The unique identifier of the product the member belongs to. Accepted here in the JSON body, or alternatively as a query parameter.Example:7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f

Query Parameters

productId
string
Alternative location for productId when you prefer not to send a request body. Use either the body field or this query parameter.Example:?productId=7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f

Response

Successful Response — HTTP 200

Main Structure (Root Object)

statusCode
integer
Status code from the API. 200 on success.
message
string
Status message that describes the result. Note the singular message key (write endpoints use message; read/list endpoints use the plural messages).
data
object
The cancellation result wrapper.
data.membershipCustomer
object
The cancelled membership customer record. Its status is now stopped.

Errors

All errors use the envelope { "statusCode": <code>, "message": "<reason>" } (singular message).
Error Example 400
{
    "statusCode": 400,
    "message": "Membership member ini sudah tidak aktif (status: stopped)."
}
statusCode
integer
The HTTP status code of the error.
message
string
A human-readable description of the error.
Common errors:
StatusmessageWhen
400Invalid path parametermemberId is missing or malformed in the path.
400Invalid request bodyproductId is missing from both the body and the query, or the request fails validation.
400Membership member ini sudah tidak aktif (status: <status>).The member is already inactive — its status is already stopped or finished (the value is interpolated into the message).
404Member dengan ID <memberId> tidak ditemukan.No membership member matches the given memberId.