afterCycle in pricingPolicies does not kick in as expected

feel like I’m missing something obvious. if anyone wants to deliver a NYE miracle haha

I’m modding the reference subscription app to fill a need for a client. basically just preorders, but for wholesale/custom orders where they need to capture the card first. can’t use deferred payments because we need to charge the payment method on a per-line-item basis & the charges will occur after 45 days at the earliest

my problem is that the afterCycle property isn’t followed when I run SubscriptionBillingCycleScheduleEdit then SubscriptionBillingCycleChargeIndexMutation on a contract created by a selling plan with the below pricing policy, the first recurring charge is also $1.

the recurring price appears correctly in checkout ($1 then $50)…

anyone else run into a similar issue? is it my responsibility as the app dev to modify the subscription price (similar to maxCycles )?

pricingPolicies: [
  {
    fixed: {
      adjustmentType: 'PRICE' as SellingPlanPricingPolicyAdjustmentType,
      adjustmentValue: {
        fixedValue: '1.00',
      },
    },
  },
  {
    recurring: {
      adjustmentType:
        'PERCENTAGE' as SellingPlanPricingPolicyAdjustmentType,
      afterCycle: 1,
      adjustmentValue: {
        percentage: 0,
      },
    },
  },
mutation SubscriptionBillingCycleScheduleEdit($billingCycleInput: SubscriptionBillingCycleInput!, $input: SubscriptionBillingCycleScheduleEditInput!) {
  subscriptionBillingCycleScheduleEdit(
    billingCycleInput: $billingCycleInput,
    input: $input
  ) {
    billingCycle {
      skipped
    }
    userErrors {
      field
      message
      code
    }
  }
}
mutation SubscriptionBillingCycleChargeIndexMutation(
  $subscriptionContractId: ID!
  $inventoryPolicy: SubscriptionBillingAttemptInventoryPolicy = PRODUCT_VARIANT_INVENTORY_POLICY
  $index: Int!
) {
  subscriptionBillingCycleCharge(
    subscriptionContractId: $subscriptionContractId
    inventoryPolicy: $inventoryPolicy
    billingCycleSelector: {
      index: $index
    }
  ) {
    subscriptionBillingAttempt {
      id
      ready
    }
    userErrors {
      field
      message
      code
    }
  }
}

Yes it’s your responsibility as the app dev

you’re given a subscription with the cycleDiscounts and you need to make modifications accordingly

(partner slack convo for future reference)

1 Like