Skip to content

API won't return contract_term on estimate.change_term_end method #44

Description

@julianCast

When we estimate change_term_end we get a estimate object
which would include subscription_estimate which would include contract_term.

But the response never contains contract_term.

Use case: Customers wants to change their next billing date, so they want to know a estimated contract_term end date before updating it.

Sample call:

  async getSubscriptionBillingDateEstimate(params: {
    subscriptionId: string;
    nextBillingDay: number;
  }): Promise<ChargebeeEstimate> {
    const result = await chargebee.estimate
      .change_term_end(params.subscriptionId, {
        term_ends_at: params.nextBillingDay,
      })
      .request();
      console.log(result.estimate)
  }

Sample output:

Estimate {
  created_at: 1700037915,
  object: 'estimate',
  credit_note_estimates: [],
  subscription_estimate: SubscriptionEstimate {
    id: 'W4UB4zTpX9vVt3hc',
    status: 'active',
    next_billing_at: 1702598400,
    object: 'subscription_estimate',
    currency_code: 'EUR',
    shipping_address: ShippingAddress {
      first_name: 'John',
      last_name: 'doe',
      email: 'johndoe@domain.com',
      phone: '+34666666666,
      line1: 'line 1',
      city: 'City',
      country: 'CC',
      zip: '00000',
      validation_status: 'not_validated',
      object: 'shipping_address'
    }
  },

  invoice_estimate: InvoiceEstimate {},
  next_invoice_estimate: InvoiceEstimate {}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions