For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
The SubscriptionContract contains BillingPolicy and DeliveryPolicy but the lines contain pricingPolicy. Just to test things out, I created a SubscriptionContract with the BillingPolicy interval set to 3 and DeliveryPolicy interval set to 1 (prepaid policy), then I updated the SubscriptionContract to change the BillingPolicy interval to 1 so that it would be a pay per delivery policy.
Then I took at the line data and saw this:
{
"id": "gid://shopify/SubscriptionLine/037c21da-dc0c-4c95-897d-d118ef1c7aff",
"quantity": 1,
"productId": "gid://shopify/Product/6716443918493",
"variantId": "gid://shopify/ProductVariant/39954168414365",
"currentPrice": {
"amount": "408.0",
"currencyCode": "CAD"
},
...
"pricingPolicy": {
"basePrice": {
"amount": "170.0",
"currencyCode": "CAD"
},
"cycleDiscounts": [
{
"afterCycle": 0,
"computedPrice": {
"amount": "408.0",
"currencyCode": "CAD"
},
"adjustmentType": "PERCENTAGE",
"adjustmentValue": {
"percentage": 20
}
},
{
"afterCycle": 3,
"computedPrice": {
"amount": "459.0",
"currencyCode": "CAD"
},
"adjustmentType": "PERCENTAGE",
"adjustmentValue": {
"percentage": 10
}
}
]
},
"sellingPlanId": "gid://shopify/SellingPlan/622559389",
"sellingPlanName": "sup prepaid",
"discountAllocations": [],
"lineDiscountedPrice": {
"amount": "408.0",
"currencyCode": "CAD"
}
}
The price of 1 unit is supposed to be $170 but I'm seeing several conflicting prices within the line, specifically:
- currentPrice
- pricingPolicy.basePrice
- pricingPolicy.cycleDiscounts[0].computedPrice
- pricingPolicy.cycleDiscounts[1].computedPrice
The output I'm seeing doesn't make sense to me when comparing to the docs, some prices are reflecting the prepaid price and some are reflecting the payperdelivery price but I figured they should all reflect payperdelivery price because I just changed the BillingPolicy and DeliveryPolicy to reflect payperdelivery. From what I currently understand, I'm supposed to update the line prices for contracts with recurring discounts as suggested in this thread:
https://community.shopify.com/c/subscription-apis/fixed-and-recurring-pricing-policies-not-working/m...
but I'm not sure what's expected in this case when I'm just switching billing/delivery policies, or any other fields of a SubscriptionContract for that matter. Also, when updating the line do I just update the currentPrice or both currentPrice and pricingPolicy.basePrice, and what about the cycleDiscounts?
I'm really confused as to when and what exactly should I update so the pricing stays in sync for the lines and contract, hoping someone can help set me straight on these issues.
Solved! Go to the solution
This is an accepted solution.
After thinking about it a bit more I think it makes sense now.
A line bought with a prepaid contract with a billing/delivery interval ratio of 3:1 will set the line's current price to x3 and the computed price to x3. That's just what happens, so if a user changes it back and forth they can change the price too. Edit: nvm, need to do more testing on this part.
I'm still not too sure about changing the line's currentPrice and/or pricingPolicy, whether changing 1 will change the other or both must be changed at the same time but I'll do more testing today.
This is an accepted solution.
After thinking about it a bit more I think it makes sense now.
A line bought with a prepaid contract with a billing/delivery interval ratio of 3:1 will set the line's current price to x3 and the computed price to x3. That's just what happens, so if a user changes it back and forth they can change the price too. Edit: nvm, need to do more testing on this part.
I'm still not too sure about changing the line's currentPrice and/or pricingPolicy, whether changing 1 will change the other or both must be changed at the same time but I'll do more testing today.