Please update the wiki for the `updateSubscriptionItem` method
Closed this issue · 1 comments
keyding commented
Hi, @brankoconjic.
Please update the Usage
and Type Declarations
sections of the updateSubscriptionItem method.
Thank you.
Usage
Before:
import { type SubscriptionItem, updateSubscriptionItem } from '@lemonsqueezy/lemonsqueezy.js';
const subscriptionItemId = 234567;
const quantity = 10;
const { statusCode, error, data } = await updateSubscriptionItem(subscriptionItemId, quantity);
After:
import { type SubscriptionItem, updateSubscriptionItem } from '@lemonsqueezy/lemonsqueezy.js';
const subscriptionItemId = 234567;
const quantity = 10;
// It will be removed with the next major version.
const { statusCode, error, data } = await updateSubscriptionItem(subscriptionItemId, quantity);
// Use the 'updateSubscriptionItem' parameter instead.
const { statusCode, error, data } = await updateSubscriptionItem(subscriptionItemId, { quantity: 20, invoiceImmediately: true });
Type Declarations
Before:
/**
* Update a subscription item.
*
* Note: this endpoint is only used with quantity-based billing. If the related subscription's product/variant has usage-based billing enabled, this endpoint will return a `422 Unprocessable Entity` response.
*
* @param subscriptionItemId The given subscription item id.
* @param quantity The unit quantity of the subscription.
* @returns A subscription item object.
*/
declare function updateSubscriptionItem(subscriptionItemId: string | number, quantity: number): Promise<FetchResponse<SubscriptionItem>>;
After:
/**
* Update a subscription item.
*
* Note: this endpoint is only used with quantity-based billing. If the related subscription's product/variant has usage-based billing enabled, this endpoint will return a `422 Unprocessable Entity` response.
*
* @param subscriptionItemId The given subscription item id.
* @param quantity The unit quantity of the subscription.
* @deprecated It will be removed with the next major version. Use the 'updateSubscriptionItem' parameter instead.
* @returns A subscription item object.
*/
declare function updateSubscriptionItem(subscriptionItemId: string | number, quantity: number): Promise<FetchResponse<SubscriptionItem>>;
/**
* Update a subscription item.
*
* Note: this endpoint is only used with quantity-based billing.
* If the related subscription's product/variant has usage-based billing
* enabled, this endpoint will return a `422 Unprocessable Entity` response.
*
* @param subscriptionItemId The given subscription item id.
* @param updateSubscriptionItem (Required) Update subscription item info.
* @param updateSubscriptionItem.quantity (Required) The unit quantity of the subscription.
* @param [updateSubscriptionItem.invoiceImmediately] (Optional) If `true`, any updates to the subscription will be charged immediately. A new prorated invoice will be generated and payment attempted. Defaults to `false`. Note that this will be overridden by the `disable_prorations` option if used.
* @param [updateSubscriptionItem.disableProrations] (Optional) If `true`, no proration will be charged and the customer will simply be charged the new price at the next renewal. Defaults to `false`. Note that this will override the `invoice_immediately` option if used.
* @returns A subscription item object.
*/
declare function updateSubscriptionItem(subscriptionItemId: string | number, updateSubscriptionItem: UpdateSubscriptionItem): Promise<FetchResponse<SubscriptionItem>>;
brankoconjic commented
Added. Thank you.