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 |
|
Method |
|
Content-Type |
|
Required Parameters
Parameter | Type | Description |
| string | Your Subscribfy API key |
| string | Shopify Customer ID (numeric part only) |
| string | Customer's email address |
| string | Action to perform (see Available Actions) |
| integer | Subscription type (see Subscription Types) |
Subscription Types
Value | Type | Description |
| VIP Membership | Standard membership subscriptions |
| Elite Membership | Premium membership tier |
| Product Subscription | Recurring product deliveries |
| Try Before You Buy | TBYB subscriptions |
Available Actions
Action | Description | Additional Parameters |
| Retrieve subscription details | None |
| Get customer's self-service portal URL | None |
| Cancel a subscription |
|
| Pause a subscription |
|
| Reactivate a paused/cancelled subscription | None |
Action-Specific Parameters
Parameter | Required For | Type | Description |
| All actions when | integer | Subscribfy contract ID (identifies which product subscription) |
|
| integer | Pause duration: 1, 2, or 3 months |
|
| string | Cancellation reason |
Response Format
Error Responses
Error | Cause |
| Missing or invalid parameters |
| API key not found or inactive |
| Shop domain not recognized |
| Customer ID/email not found |
| No membership exists for type 1/2 |
| No subscription exists for type 3/4 |
| Missing contract ID for product subscription |
| 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 |
| string | Membership plan name |
| string | ACTIVE, PAUSED, or CANCELLED |
| string | Price with currency and billing frequency |
| string | Next charge date (if active/paused) |
| string | Self-service portal URL |
| string | Credits held during checkout |
| string | Available store credits |
Product Subscription Response (type=3)
Field | Type | Description |
| integer | Contract ID (use for actions) |
| string | Subscription name |
| string | ACTIVE, PAUSED, or CANCELLED |
| string | Subscription start date (YYYY-MM-DD) |
| string | Price with delivery frequency |
| string | Next delivery/charge date |
| array | Products in subscription |
| string | Product title |
| string | Product image URL |
Rate Limits
Minimum 10 seconds between actions (cancel, pause, reactivate) per customer
getContentandgetCustomerMembershipManageURLare not rate limitedExceeding rate limit returns
{"error": "Too many requests."}
Best Practices
Always verify customer identity - Both
cidandemailmust matchCache 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