Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
julianCast opened this issue Nov 15, 2023 · 0 comments
Open

Comments

@julianCast
Copy link

julianCast commented Nov 15, 2023

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: '[email protected]',
      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 {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant