Core customer portal APIs for managing customer account settings, authentication, and portal configurations.
- Get variant contextual pricing
Customer Portal APIs (0.0.1)
Comprehensive API documentation for the customer-facing subscription portal. These APIs enable customers to manage their subscriptions, update billing information, modify delivery schedules, and access their account details through your storefront.
Important: These APIs must be called from your shop's domain (e.g., https://www.myshop.com/apps/subscriptions/cp/api/**) and require customer authentication. Unauthenticated requests will return a 401 Unauthorized error.
Request
Replaces existing product variants with new ones in a subscription contract. This endpoint supports both regular subscription products and one-time products, allowing you to swap products, update quantities, and manage the product mix in a subscription.
Key Features:
- Bulk Replace: Replace multiple products at once by providing lists of old and new variants
- Line-Specific Replace: Target a specific line item using oldLineId for precise replacement
- Quantity Management: Set new quantities for replaced products
- One-Time Products: Add or remove one-time purchase products independently
- Discount Preservation: Configurable discount carry-forward logic
Discount Carry Forward Options:
- PRODUCT_THEN_EXISTING: First tries to apply the new product's selling plan discount, then falls back to existing discount
- PRODUCT_PLAN: Always uses the new product's selling plan discount
- EXISTING_PLAN: Maintains the existing product's discount structure
Important Notes:
- At least one regular subscription product must remain in the contract
- One-time products and free products don't count towards the minimum product requirement
- The system automatically handles pricing adjustments based on billing/delivery intervals
- Shipping prices are automatically recalculated after changes
Use Cases:
- Product upgrades/downgrades (e.g., switching coffee blend or size)
- Quantity adjustments during product swap
- Adding limited-time or seasonal products as one-time purchases
- Bulk product replacements for subscription migrations
Authentication: Requires valid X-API-Key header
List of variant IDs to remove from the subscription. These are numeric Shopify variant IDs. Either provide oldVariants OR oldLineId, not both.
Map of new variant IDs to their quantities. Key is the numeric Shopify variant ID, value is the desired quantity. If a variant already exists in the subscription and the system is configured to update existing quantities, the quantity will be added to the existing quantity.
Map of one-time product variant IDs to add with their quantities. These products will be charged only once with the next order and won't recur. Useful for add-ons, samples, or limited-time offers.
List of one-time product variant IDs to remove from the subscription. Only removes one-time products that haven't been fulfilled yet.
Specific subscription line ID to replace. Use this for targeted replacement of a single line item. When provided, oldVariants should be empty. Format: gid://shopify/SubscriptionLine/[ID]
Determines how discounts are applied to new products when replacing variants. If not specified, uses the merchant's default setting.
- https://www.myshop.com/apps/subscriptions/cp/api/subscription-contract-details/replace-variants-v3
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://www.myshop.com/apps/subscriptions/cp/api/subscription-contract-details/replace-variants-v3 \
-H 'Content-Type: application/json' \
-d '{
"shop": "abcStore.myshopify.com",
"contractId": 123456789,
"oldVariants": [
42549172011164,
42549172022222
],
"newVariants": {
"42549172033333": 2,
"42549172044444": 1
},
"newOneTimeVariants": {
"42549172066666": 1,
"42549172077777": 2
},
"oldOneTimeVariants": [
42549172055555,
42549172088888
],
"oldLineId": "gid://shopify/SubscriptionLine/987654321",
"eventSource": "CUSTOMER_PORTAL",
"carryForwardDiscount": "PRODUCT_THEN_EXISTING",
"stopSwapEmails": false
}'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-02-15T00:00:00Z", "lines": { "edges": [ … ] } }
Request
Retrieves contextual pricing information for a product variant based on currency and country. This endpoint provides localized pricing data for international subscriptions and multi-currency support.
Pricing Information Returned:
- Base price in specified currency
- Compare-at price (if applicable)
- Country-specific pricing adjustments
- Tax information for the region
- Currency conversion data
Parameters:
variantId- Shopify variant ID (required)currencyCode- ISO 4217 currency code (e.g., USD, EUR, GBP) (required)countryCode- ISO 3166-1 country code (e.g., US, GB, CA) (optional)
Use Cases:
- Display localized pricing in customer portal
- Calculate subscription totals for international customers
- Support multi-currency subscriptions
- Show accurate pricing based on customer location
- Validate pricing before subscription creation
Important Notes:
- Requires Shopify Markets or multi-currency setup
- Prices are returned in the requested currency
- Country-specific pricing takes precedence over currency-only pricing
- Returns 404 if variant doesn't exist or isn't available in specified market
Authentication: Requires valid api_key parameter
- https://www.myshop.com/apps/subscriptions/cp/api/data/variant-contextual-pricing
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://www.myshop.com/apps/subscriptions/cp/api/data/variant-contextual-pricing?variantId=0&countryCode=string¤cyCode=string'Request
Retrieves all selling plans (subscription plans) associated with a set of products. This endpoint is useful for determining which subscription options are available for specific products.
Selling Plan Information:
- Selling plan ID and name
- Billing and delivery frequencies
- Pricing policies (discounts)
- Plan description and options
- Product associations
Use Cases:
- Display subscription options on product pages
- Validate subscription plan availability
- Build subscription plan selector UI
- Sync plan data across systems
Request:
- Accepts multiple product IDs as comma-separated values
- Returns aggregated selling plans from all products
Authentication: Requires valid api_key parameter
- https://www.myshop.com/apps/subscriptions/cp/api/data/products-selling-plans
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://www.myshop.com/apps/subscriptions/cp/api/data/products-selling-plans?productIds=0'