# Customer Portal APIs Important Note: The APIs in this document are for reference only and will not work directly in Swagger. To use these APIs, you need to call them from your shop. The base URL for these APIs is your shop's domain. For example, if your shop domain is https://www.myshop.com/apps, then the full API endpoint will be based on this domain (e.g., https://www.myshop.com/apps/memberships/cp/api/**). Please ensure the customer is logged in when calling the Customer Portal Proxy API. If the customer is not logged in, the API will return a 401 Unauthorized error. Version: 0.0.1 ## Servers ``` https://www.myshop.com/apps ``` ## Download OpenAPI description [Customer Portal APIs](https://developers.membership.appstle.com/_bundle/storefront-api-swagger.yaml) ## Shipping & Delivery Profiles APIs for managing Shopify delivery profiles, shipping rates, zones, and free shipping configuration for subscription memberships ### getLocations - [GET /memberships/cp/api/delivery-profiles/get-locations](https://developers.membership.appstle.com/storefront-api-swagger/shipping-and-delivery-profiles/getlocations.md) ## Custom CSS Styling APIs for retrieving custom CSS styles applied to subscription widgets and customer portal for theme customization ### getSubscriptionCustomCss - [GET /memberships/cp/api/subscription-custom-csses/{id}](https://developers.membership.appstle.com/storefront-api-swagger/custom-css-styling/getsubscriptioncustomcss.md) ## Customer Discount History APIs for retrieving historical discount code usage and redemption information for membership contracts ### getCustomerDiscountDetails - [GET /memberships/cp/api/customer-discount-code-infos/get-past-discounts](https://developers.membership.appstle.com/storefront-api-swagger/customer-discount-history/getcustomerdiscountdetails.md) ## Customer Portal Configuration APIs for managing customer portal settings including UI customization, text labels, feature toggles, and branding options for the member self-service portal ### getCustomerPortalSettings - [GET /memberships/cp/api/customer-portal-settings/{id}](https://developers.membership.appstle.com/storefront-api-swagger/customer-portal-configuration/getcustomerportalsettings.md) ## Cancellation Flow Configuration APIs for managing membership cancellation flow settings including retention offers, survey questions, and cancel confirmation screens ### getCancellationManagement - [GET /memberships/cp/api/cancellation-managements/{id}](https://developers.membership.appstle.com/storefront-api-swagger/cancellation-flow-configuration/getcancellationmanagement.md) ## Membership Contracts APIs for managing membership/subscription contracts including creation, updates, status changes, line items, discounts, and billing operations ### addLineItem - [PUT /memberships/cp/api/v2/subscription-contracts-add-line-item](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/addlineitem.md) ### Update membership contract status - [PUT /memberships/cp/api/subscription-contracts-update-status](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatestatus.md): Updates the status of an existing membership contract (ACTIVE, PAUSED, CANCELLED, or EXPIRED). This is one of the most critical operations for managing membership lifecycles. Supported Status Values: - ACTIVE: Membership is active and will process recurring billing - PAUSED: Membership is temporarily paused, no billing will occur - CANCELLED: Membership is permanently cancelled, no future billing - EXPIRED: Membership has expired (typically used when max cycles reached) Pause Duration: - When pausing, you can optionally specify pauseDurationCycle to auto-resume after N cycles - If not specified, membership remains paused until manually reactivated Business Rules & Validations: - Customer Portal Restrictions: When called from customer portal, additional validations apply: - Cannot modify frozen memberships (freeze till min cycle condition) - Must respect billing cycle limits configured by merchant - Contract Validation: System validates that the contract belongs to the authenticated shop - Activity Logging: All status changes are logged with source (merchant portal vs customer portal) Use Cases: - Customer wants to pause their membership temporarily - Merchant needs to cancel a membership due to customer request - Reactivating a paused membership - Marking membership as expired when max cycles reached Authentication: Requires authenticated shop user or customer portal token ### updateShippingAddress - [PUT /memberships/cp/api/subscription-contracts-update-shipping-address](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updateshippingaddress.md) ### updatePaymentMethod - [PUT /memberships/cp/api/subscription-contracts-update-payment-method](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatepaymentmethod.md) ### updateOrderNote - [PUT /memberships/cp/api/subscription-contracts-update-order-note/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updateordernote.md) ### updateLineItemAttributes - [PUT /memberships/cp/api/subscription-contracts-update-line-item-attributes](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatelineitemattributes.md) ### updateExistingPaymentMethod - [PUT /memberships/cp/api/subscription-contracts-update-existing-payment-method](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updateexistingpaymentmethod.md) ### updateBillingInterval - [PUT /memberships/cp/api/subscription-contracts-update-billing-interval](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatebillinginterval.md) ### updateNextBillingDate - [PUT /memberships/cp/api/subscription-contracts-update-billing-date](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatenextbillingdate.md) ### removeLineItem - [PUT /memberships/cp/api/subscription-contracts-remove-line-item](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/removelineitem.md) ### removeDiscount - [PUT /memberships/cp/api/subscription-contracts-remove-discount](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/removediscount.md) ### addCancellationDiscount - [PUT /memberships/cp/api/subscription-contracts-cancellation-discount](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/addcancellationdiscount.md) ### applyDiscountCode - [PUT /memberships/cp/api/subscription-contracts-apply-discount](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/applydiscountcode.md) ### Add a product to an existing membership contract - [PUT /memberships/cp/api/subscription-contracts-add-line-item](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/addlineitem_1.md): Adds a new product/variant line item to an existing active membership contract. This allows customers or merchants to add additional products to their recurring membership orders. Key Features: - Add any product variant to an existing membership - Specify custom quantity and price per line item - Product will be included in all future billing cycles - Price is per-item, total line price = price × quantity Important Notes: - Immediate Effect: Product is added immediately and will appear in the next billing cycle - Price Override: The price parameter allows setting a custom price (e.g., member discount) - Activity Logging: Addition is logged for audit trail - Validation: System validates that the variant exists and is available Common Use Cases: - Customer wants to add more products to their monthly membership box - Merchant adds a complimentary product to a membership - Upgrading membership with additional items - Adding seasonal or limited-time products to existing memberships Price Considerations: - Price is specified in shop's currency - Can be set to member-only pricing (different from regular product price) - Zero price is allowed for free add-ons Variant ID Format: - Accepts both numeric ID (e.g., '987654321') and Shopify GID format - System will convert to proper Shopify GraphQL format internally Authentication: Requires authenticated shop user or customer portal token ### updateVariant - [PUT /memberships/cp/api/subscription-contract-update-variant](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatevariant.md) ### updateSubscriptionContractDetails - [PUT /memberships/cp/api/subscription-contract-details](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/updatesubscriptioncontractdetails.md) ### getSubscriptionCustomerForCP - [GET /memberships/cp/api/subscription-customers](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getsubscriptioncustomerforcp.md) ### getValidSubscriptionCustomerForCP - [GET /memberships/cp/api/subscription-customers/valid](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getvalidsubscriptioncustomerforcp.md) ### getValidSubscriptionCustomerDetails - [GET /memberships/cp/api/subscription-customers-detail/valid/{id}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getvalidsubscriptioncustomerdetails.md) ### getSubscriptionContractRaw - [GET /memberships/cp/api/subscription-contracts/contract/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getsubscriptioncontractraw.md) ### getSubscriptionContractRawExternal - [GET /memberships/cp/api/subscription-contracts/contract-external/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getsubscriptioncontractrawexternal.md) ### emailMagicLink - [GET /memberships/cp/api/subscription-contracts-email-magic-link](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/emailmagiclink.md) ### getPendingDowngrade - [GET /memberships/cp/api/subscription-contract-details/{contractId}/pending-downgrade](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getpendingdowngrade.md) ### cancelPendingDowngrade - [DELETE /memberships/cp/api/subscription-contract-details/{contractId}/pending-downgrade](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/cancelpendingdowngrade.md) ### getSubscriptionFulfillments - [GET /memberships/cp/api/subscription-contract-details/subscription-fulfillments/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getsubscriptionfulfillments.md) ### getShopifyCustomerPaymentDetails - [GET /memberships/cp/api/subscription-contract-details/shopify/customer/{customerId}/payment-methods](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getshopifycustomerpaymentdetails.md) ### getSubscriptionOrderNote - [GET /memberships/cp/api/subscription-contract-details/customer/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getsubscriptionordernote.md) ### getCurrentCycleOfSubscriptionContract - [GET /memberships/cp/api/subscription-contract-details/current-cycle/{contractId}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/getcurrentcycleofsubscriptioncontract.md) ### Cancel a membership contract - [DELETE /memberships/cp/api/subscription-contracts/{id}](https://developers.membership.appstle.com/storefront-api-swagger/membership-contracts/deletesubscriptioncontract.md): Permanently cancels an active membership contract in Shopify. This operation stops all future billing and marks the membership as CANCELLED. Important Notes: - Permanent Action: Cancellation cannot be undone. A new membership must be created to re-subscribe. - Email Notification: Cancellation email is automatically sent to the customer - Activity Logging: Cancellation is logged with reason/feedback for analytics - Immediate Effect: No future billing attempts will be made Customer Portal Restrictions: When called from customer portal, additional validations apply: - Minimum Cycles: Cannot cancel if membership hasn't completed minimum required billing cycles - Frozen Memberships: Cannot cancel memberships that are frozen until min cycle completion - Attribute-Based Limits: Respects any custom attribute-based cancellation restrictions Cancellation Feedback: - Optional cancellationFeedback parameter to capture why customer is cancelling - Common values: 'TOO_EXPENSIVE', 'NO_LONGER_NEEDED', 'SWITCHING_TO_COMPETITOR', 'OTHER' - Helps merchants understand churn reasons Use Cases: - Customer requests to cancel their membership - Merchant manually cancels membership (e.g., payment issues, customer request) - Automated cancellation after max cycles reached Authentication: Requires authenticated shop user or customer portal token ## Billing & Orders APIs for managing membership billing attempts, recurring orders, payment retries, order history, and order skipping ### Skip an upcoming billing order - [PUT /memberships/cp/api/subscription-billing-attempts/skip-order/{id}](https://developers.membership.appstle.com/storefront-api-swagger/billing-and-orders/skiporder.md): Skips the next scheduled billing/order for a membership contract. The membership remains active, but the next billing date is moved to the following cycle. Key Features: - Skip next billing without canceling membership - Automatically reschedule to next billing cycle - Works for both regular and prepaid memberships - Activity logging for audit trail How It Works: 1. Validates billing attempt exists and belongs to shop 2. Updates next billing date to skip current cycle 3. Moves billing to the next scheduled interval 4. Logs activity (customer portal vs merchant portal) Customer Portal Restrictions: - Cannot skip if membership is frozen until min cycles - Validates contract ownership for security Use Cases: - Customer is traveling and wants to skip one delivery - Customer has excess inventory and wants to pause one cycle - Merchant wants to skip a billing due to out-of-stock items - Skip billing for special circumstances (holidays, etc.) Prepaid Handling: - Set isPrepaid=true for prepaid memberships - Different validation logic for prepaid vs pay-as-you-go Authentication: Requires authenticated shop user or customer portal token ### attemptBilling - [PUT /memberships/cp/api/subscription-billing-attempts/attempt-billing/{id}](https://developers.membership.appstle.com/storefront-api-swagger/billing-and-orders/attemptbilling.md) ### updateSubscriptionBillingAttempt - [PUT /memberships/cp/api/subscription-billing-attempts](https://developers.membership.appstle.com/storefront-api-swagger/billing-and-orders/updatesubscriptionbillingattempt.md) ### getTopOrdersForCP - [GET /memberships/cp/api/subscription-billing-attempts/top-orders](https://developers.membership.appstle.com/storefront-api-swagger/billing-and-orders/gettopordersforcp.md) ### getPastOrdersForCP - [GET /memberships/cp/api/subscription-billing-attempts/past-orders](https://developers.membership.appstle.com/storefront-api-swagger/billing-and-orders/getpastordersforcp.md) ## Product & Inventory Data APIs for retrieving product catalog, variants, pricing, and inventory information for subscription memberships ### getVariantContextualPricing - [GET /memberships/cp/api/data/variant-contextual-pricing](https://developers.membership.appstle.com/storefront-api-swagger/product-and-inventory-data/getvariantcontextualpricing.md) ### getSellingPlanProductsData - [GET /memberships/cp/api/data/selling-plan-products](https://developers.membership.appstle.com/storefront-api-swagger/product-and-inventory-data/getsellingplanproductsdata.md) ### getProductsData - [GET /memberships/cp/api/data/products](https://developers.membership.appstle.com/storefront-api-swagger/product-and-inventory-data/getproductsdata.md) ### getProductSellingPlanVariantData - [GET /memberships/cp/api/data/product-selling-plan-variant](https://developers.membership.appstle.com/storefront-api-swagger/product-and-inventory-data/getproductsellingplanvariantdata.md) ### getProductData - [GET /memberships/cp/api/data/product](https://developers.membership.appstle.com/storefront-api-swagger/product-and-inventory-data/getproductdata.md) ## One-Time Add-Ons APIs for managing one-time product additions to upcoming subscription orders, including adding, retrieving, and removing one-off items ### saveOneOffBy - [PUT /memberships/cp/api/subscription-contract-one-offs-by-contractId-and-billing-attempt-id](https://developers.membership.appstle.com/storefront-api-swagger/one-time-add-ons/saveoneoffby.md) ### getOneOffsForSubscriptionContract - [GET /memberships/cp/api/subscription-contract-one-offs-by-contractId](https://developers.membership.appstle.com/storefront-api-swagger/one-time-add-ons/getoneoffsforsubscriptioncontract.md) ## Membership Plans APIs for managing membership/subscription plan groups, including creating plans, configuring discounts, billing intervals, and assigning products to plans ### getAllSellingPlans - [GET /memberships/cp/api/subscription-groups/all-selling-plans](https://developers.membership.appstle.com/storefront-api-swagger/membership-plans/getallsellingplans.md) ## Product Swap Rules APIs for retrieving product swap/substitution options allowing members to exchange subscription items based on configured swap rules and variant groups ### getProductSwapsByVariantId - [POST /memberships/cp/api/product-swaps-by-variant-groups](https://developers.membership.appstle.com/storefront-api-swagger/product-swap-rules/getproductswapsbyvariantid.md) ## loyalty-integration-resource ### redeemPoints - [POST /memberships/cp/api/loyalty-integration/redeem](https://developers.membership.appstle.com/storefront-api-swagger/loyalty-integration-resource/redeempoints.md) ### getRedeemOptions - [GET /memberships/cp/api/loyalty-integration/redeem-options](https://developers.membership.appstle.com/storefront-api-swagger/loyalty-integration-resource/getredeemoptions.md) ### getEarnOptions - [GET /memberships/cp/api/loyalty-integration/earn-options](https://developers.membership.appstle.com/storefront-api-swagger/loyalty-integration-resource/getearnoptions.md) ### fetchCustomerDetail - [GET /memberships/cp/api/loyalty-integration/customer](https://developers.membership.appstle.com/storefront-api-swagger/loyalty-integration-resource/fetchcustomerdetail.md) ## customer-retention-activity-resource ### createCustomerRetentionActivity - [POST /memberships/cp/api/customer-retention-activities](https://developers.membership.appstle.com/storefront-api-swagger/customer-retention-activity-resource/createcustomerretentionactivity.md) ## shop-info-resource ### getShopInfoByCurrentLogin - [GET /memberships/cp/api/shop-infos-by-current-login](https://developers.membership.appstle.com/storefront-api-swagger/shop-info-resource/getshopinfobycurrentlogin.md)