Skip to main content

Membership Management API

Backend API for managing subscription content, pause/cancel workflows, and generating customer portal URLs.

Updated over a month ago

Membership Management API

The Membership Management API allows you to programmatically manage customer subscriptions and memberships. Use this endpoint to retrieve subscription details, cancel, pause, or reactivate memberships from your own systems or third-party integrations.


Authentication

All requests require your Subscribfy API key. Go to Shopify -> Apps -> Subscribfy -> Integration and copy the API Key.


Endpoint

Property

Value

URL

{store}.myshopify.com/apps/subscribfy-api/v1/membership/manage

Method

POST

Content-Type

application/x-www-form-urlencoded


Required Parameters

Parameter

Type

Description

key

string

Your Subscribfy API key

cid

string

Shopify Customer ID (numeric part only)

email

string

Customer's email address

action

string

Action to perform (see Available Actions)

type

integer

Subscription type (see Subscription Types)

Subscription Types

Value

Type

Description

1

VIP Membership

Standard membership subscriptions

2

Elite Membership

Premium membership tier

3

Product Subscription

Recurring product deliveries

4

Try Before You Buy

TBYB subscriptions


Available Actions

Action

Description

Additional Parameters

getContent

Retrieve subscription details

None

getCustomerMembershipManageURL

Get customer's self-service portal URL

None

updateCancelContent

Cancel a subscription

reason (required)

updatePauseContent

Pause a subscription

period (required, 1-3 months)

updateReactivateContent

Reactivate a paused/cancelled subscription

None

Action-Specific Parameters

Parameter

Required For

Type

Description

scid

All actions when type=3

integer

Subscribfy contract ID (identifies which product subscription)

period

updatePauseContent

integer

Pause duration: 1, 2, or 3 months

reason

updateCancelContent

string

Cancellation reason


Response Format

Error Responses

Error

Cause

{"error": "Bad request."}

Missing or invalid parameters

{"error": "Invalid API key."}

API key not found or inactive

{"error": "Store not found."}

Shop domain not recognized

{"error": "Customer not found."}

Customer ID/email not found

{"error": "No membership found."}

No membership exists for type 1/2

{"error": "No subscription found."}

No subscription exists for type 3/4

{"error": "The parameter 'scid' is required when 'type' is 3."}

Missing contract ID for product subscription

{"error": "Too many requests."}

Rate limit exceeded (10 second cooldown)


Examples

Get Membership Content (type=1)

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=getContent" \
  -d "type=1"

Response:

{
  "membership": {
    "title": "VIP Membership",
    "status": "ACTIVE",
    "price": "29.00 USD billed every 1 month",
    "next_billing_date": "February 15, 2025",
    "CustomerMembershipManageURL": "https://your-store.myshopify.com/a/manage/abc123"
  },
  "storeCreditNotification": {
    "pending_amount": "0.00",
    "store_credits_available_balance": "45.00"
  }
}

Get Product Subscriptions (type=3)

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=getContent" \
  -d "type=3"

Response:

{
  "product_subscription": [
    {
      "scid": 456,
      "title": "Monthly Coffee Box",
      "status": "ACTIVE",
      "start_date": "2024-11-01",
      "price": "24.99 USD Delivery every 1 month",
      "next_billing_date": "February 1, 2025",
      "items": [
        {
          "title": "Premium Blend Coffee 250g",
          "main_img": "https://cdn.shopify.com/s/files/..."
        },
        {
          "title": "Artisan Roast 250g",
          "main_img": "https://cdn.shopify.com/s/files/..."
        }
      ]
    },
    {
      "scid": 457,
      "title": "Weekly Snack Box",
      "status": "PAUSED",
      "start_date": "2024-09-15",
      "price": "15.99 USD Delivery every 1 week",
      "items": [
        {
          "title": "Mixed Nuts Pack",
          "main_img": "https://cdn.shopify.com/s/files/..."
        }
      ]
    }
  ]
}

Get Customer Portal URL

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=getCustomerMembershipManageURL" \
  -d "type=1"

Response:

{
  "membership": {
    "CustomerMembershipManageURL": "https://your-store.myshopify.com/a/manage/abc123"
  }
}

Cancel Membership

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=updateCancelContent" \
  -d "type=1" \
  -d "reason=Too expensive"

Response:

{"result": "success"}

Pause Product Subscription

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=updatePauseContent" \
  -d "type=3" \
  -d "scid=456" \
  -d "period=2"

Response:

{"result": "success"}

Reactivate Subscription

curl -X POST "https://your-store.myshopify.com/apps/subscribfy-api/v1/membership/manage" \
  -d "key=your_api_key" \
  -d "cid=7834521098" \
  -d "email=customer@example.com" \
  -d "action=updateReactivateContent" \
  -d "type=3" \
  -d "scid=456"

Response:

{"result": "success"}


Code Examples

PHP

$apiKey = 'your_api_key';
$store = 'your-store.myshopify.com';$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => "https://{$store}/apps/subscribfy-api/v1/membership/manage",
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query([
        'key' => $apiKey,
        'cid' => '7834521098',
        'email' => 'customer@example.com',
        'action' => 'getContent',
        'type' => 1
    ]),
    CURLOPT_RETURNTRANSFER => true
]);$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);$data = json_decode($response, true);if (isset($data['error'])) {
    echo "Error: " . $data['error'];
} else {
    echo "Status: " . $data['membership']['status'];
    echo "Next billing: " . $data['membership']['next_billing_date'];
}

Node.js

const axios = require('axios');const apiKey = 'your_api_key';
const store = 'your-store.myshopify.com';async function getMembershipContent(customerId, email) {
    try {
        const response = await axios.post(
            `https://${store}/apps/subscribfy-api/v1/membership/manage`,
            new URLSearchParams({
                key: apiKey,
                cid: customerId,
                email: email,
                action: 'getContent',
                type: '1'
            })
        );        const { membership, storeCreditNotification } = response.data;
        console.log(`Status: ${membership.status}`);
        console.log(`Credits: ${storeCreditNotification.store_credits_available_balance}`);        return response.data;
    } catch (error) {
        console.error('Error:', error.response?.data?.error || error.message);
    }
}async function pauseSubscription(customerId, email, contractId, months) {
    const response = await axios.post(
        `https://${store}/apps/subscribfy-api/v1/membership/manage`,
        new URLSearchParams({
            key: apiKey,
            cid: customerId,
            email: email,
            action: 'updatePauseContent',
            type: '3',
            scid: contractId,
            period: months
        })
    );    return response.data.result === 'success';
}

Python

import requestsapi_key = 'your_api_key'
store = 'your-store.myshopify.com'
base_url = f'https://{store}/apps/subscribfy-api/v1/membership/manage'def get_membership(customer_id, email):
    response = requests.post(base_url, data={
        'key': api_key,
        'cid': customer_id,
        'email': email,
        'action': 'getContent',
        'type': 1
    })    data = response.json()
    if 'error' in data:
        raise Exception(data['error'])    return datadef cancel_membership(customer_id, email, reason):
    response = requests.post(base_url, data={
        'key': api_key,
        'cid': customer_id,
        'email': email,
        'action': 'updateCancelContent',
        'type': 1,
        'reason': reason
    })    return response.json().get('result') == 'success'def get_product_subscriptions(customer_id, email):
    response = requests.post(base_url, data={
        'key': api_key,
        'cid': customer_id,
        'email': email,
        'action': 'getContent',
        'type': 3
    })    data = response.json()
    return data.get('product_subscription', [])


Response Field Reference

Membership Response (type=1, 2)

Field

Type

Description

membership.title

string

Membership plan name

membership.status

string

ACTIVE, PAUSED, or CANCELLED

membership.price

string

Price with currency and billing frequency

membership.next_billing_date

string

Next charge date (if active/paused)

membership.CustomerMembershipManageURL

string

Self-service portal URL

storeCreditNotification.pending_amount

string

Credits held during checkout

storeCreditNotification.store_credits_available_balance

string

Available store credits

Product Subscription Response (type=3)

Field

Type

Description

product_subscription[].scid

integer

Contract ID (use for actions)

product_subscription[].title

string

Subscription name

product_subscription[].status

string

ACTIVE, PAUSED, or CANCELLED

product_subscription[].start_date

string

Subscription start date (YYYY-MM-DD)

product_subscription[].price

string

Price with delivery frequency

product_subscription[].next_billing_date

string

Next delivery/charge date

product_subscription[].items[]

array

Products in subscription

product_subscription[].items[].title

string

Product title

product_subscription[].items[].main_img

string

Product image URL


Rate Limits

  • Minimum 10 seconds between actions (cancel, pause, reactivate) per customer

  • getContent and getCustomerMembershipManageURL are not rate limited

  • Exceeding rate limit returns {"error": "Too many requests."}


Best Practices

  • Always verify customer identity - Both cid and email must match

  • Cache portal URLs - The management URL doesn't change frequently

  • Handle all error cases - Check for error key before processing response

  • Use scid for product subscriptions - Customers may have multiple subscriptions

  • Respect rate limits - Wait 10+ seconds between state-changing actions


Use Cases

Customer Service Integration

Integrate with Gorgias, Zendesk, or other helpdesk tools to display membership status and allow agents to manage subscriptions directly.

Custom Customer Portal

Build a branded self-service portal using the getContent action to fetch data and action endpoints to handle changes.

Churn Prevention

Intercept cancellation requests, offer alternatives (pause instead of cancel), and track cancellation reasons for analysis.


Questions? Contact support@subscribfy.com

Did this answer your question?