How to keep pricing policies up to date?

hernancarrizo
Tourist
3 0 3

Hello, we're trying to understand how to use and maintain pricing policies with subscription contracts. We're able to setup selling plans with the corresponding pricing policies for our app. When a subscription is created, we're getting the SubscriptionContract created with the pricing policy "applied" in the corresponding line items.

Now we're trying to understand how we should proceed with the pricing policies after the subscription contract has been created. Our understanding so far is:

  • On subscription creation, Shopify is setting up the line items + the corresponding SubscriptionCyclePriceAdjustment attached to it (if there's a pricing policy applied to the line item). After the subscription creation, is our app the one responsible to update the line item's `currentPrice` property on every successful billing attempt (as discussed in this thread). Is this correct?
  • If at some point, our app needs to update a line item (for example, change a product from the subscription). We have a couple of questions here:
    • Is there a way through the API to get the selling plans applicable for a product variant ID? The seelingPlanGroups query doesn't have a filter per productId or variantId. So, the only way for us to get the candidate selling plans is filtering through the delivery_frequency and then find manually the applicable selling plans. Is this the best way to do it?
    • Once we have the selling plan to be applied to the new line item, is there a way through the API to generate the SubscriptionCyclePriceAdjustment records (to be set as part of the input payload in the subscriptionDraftLineAdd mutation)? We tried setting the selling plan ID, but that doesn't calculate / generate the SubscriptionCyclePriceAdjustment records for the pricing policies associated to the specified selling plan. Do we have to manually recreate these records in our app? (this seems to be already sorted out by Shopify and ideally we would prefer to rely on that implementation that already knows and understands all the logic behind the pricing policies and types of discounts that are supported by Shopify).