Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Carry tax behaviour onto the replacement price in the reprice script (#3310)

Luke Vellaf49bb44f2854
diff --git a/packages/billing/src/scripts/reprice-pro.ts b/packages/billing/src/scripts/reprice-pro.ts
index 5c1c720cd..6bd554471 100644
--- a/packages/billing/src/scripts/reprice-pro.ts
+++ b/packages/billing/src/scripts/reprice-pro.ts
@@ -101,7 +101,7 @@ function describe(price: Stripe.Price) {
const options = Object.entries(price.currency_options ?? {})
.map(([currency, option]) => `${currency}=${option.unit_amount}`)
.join(",");
- return `${price.id} (${price.currency}=${price.unit_amount}${options ? `, ${options}` : ""})`;
+ return `${price.id} (${price.currency}=${price.unit_amount}${options ? `, ${options}` : ""}, tax ${price.tax_behavior ?? "unspecified"})`;
}
function toCreateParams(
@@ -114,6 +114,11 @@ function toCreateParams(
currency: "usd",
unit_amount: usd,
recurring: { interval: spec.interval },
+ // Automatic tax reads this per price; inheriting it keeps VAT inclusive
+ // or exclusive exactly as on the price being replaced.
+ ...(oldPrice.tax_behavior && oldPrice.tax_behavior !== "unspecified"
+ ? { tax_behavior: oldPrice.tax_behavior }
+ : {}),
metadata: { [REPLACES_METADATA_KEY]: oldPrice.id },
currency_options: Object.fromEntries(
Object.entries(others).map(([currency, amount]) => [