Membership Contracts
Generate customer portal magic link
Generates a secure, time-limited magic link that allows customers to access and manage their memberships. This passwordless authentication link directs customers to the membership management portal.
Magic Link Features:
- Passwordless Access: No login credentials required, link serves as authentication
- Time-Limited: Link expires after configured duration (typically 24-72 hours)
- Single Customer: Link is bound to specific customer ID, cannot be reused for others
- Secure Token: Uses cryptographically secure JWT tokens for authentication
- Customer Portal: Directs to full-featured self-service membership portal
Returned Information:
- Magic Link URL: Full URL to customer portal with embedded authentication token
- Token: JWT token value (can be used separately if needed)
- Expiration Time: When the magic link will expire (ISO 8601 format)
- Customer ID: Shopify customer ID the link is generated for
- Shop Domain: Store domain where memberships are hosted
Customer Portal Capabilities (via Magic Link):
- View all active and paused membership contracts
- Update shipping address for upcoming deliveries
- Change payment method for future billing
- Pause or resume membership deliveries
- Skip upcoming delivery orders
- Modify delivery frequency (e.g., monthly to bi-monthly)
- Add or remove products from membership
- Swap product variants (size, flavor, color)
- Cancel membership with reason feedback
- View order history and upcoming deliveries
- Apply discount codes to membership
Common Use Cases:
- Send magic link via email for customer self-service
- Include link in transactional emails (order confirmation, shipping notices)
- Customer support: provide link to customers over phone/chat
- Embed link in customer account page or dashboard
- Automated email campaigns for membership management reminders
- Post-purchase flows to encourage membership modifications
- Win-back campaigns: send magic link to cancelled/paused customers
Security Notes:
- Links are single-use per session (new token generated each time)
- Tokens include shop and customer validation to prevent tampering
- Expired links automatically redirect to token request page
- Links should be sent via secure channels (HTTPS, encrypted email)
Integration Best Practices:
- Always send magic links via email or SMS (don’t display on public pages)
- Set appropriate expiration time based on use case
- Include clear call-to-action in emails (“Manage Your Membership”)
- Handle expired tokens gracefully with re-send functionality
- Track magic link generation for security audit logs
Authentication: Requires API key authentication via X-API-Key header or api_key parameter
GET
/
api
/
external
/
v2
/
manage-subscription-link
/
{customerId}
Generate customer portal magic link
curl --request GET \
--url https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}import requests
url = "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}';
const options = {method: 'GET'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}Headers
Path Parameters
Shopify customer ID
Query Parameters
API Key (Deprecated - Use Header X-API-Key instead)
Response
Magic link generated successfully, returns link URL and expiration time
⌘I
Generate customer portal magic link
curl --request GET \
--url https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}import requests
url = "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}';
const options = {method: 'GET'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://membership-admin.appstle.com/api/external/v2/manage-subscription-link/{customerId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}{
"manageSubscriptionLink": "https://myshop.com/apps/memberships/cp/manage?token=abc123",
"tokenExpirationTime": "2023-11-07T05:31:56Z"
}