chore(api): handle missing discountId

This commit is contained in:
isra el
2026-02-09 06:32:58 +03:00
parent b1281d4ec1
commit eb94085f6e

View File

@@ -306,11 +306,14 @@ export class BillingService {
}
try {
const discount = await this.polarApi.discounts.get({
id: discountId,
})
if (discount) {
checkoutOptions.discountId = discount.id
let discount = null;
if (discountId) {
discount = await this.polarApi.discounts.get({
id: discountId,
})
if (discount) {
checkoutOptions.discountId = discount.id
}
}
} catch (error) {
console.error('failed to get discount', error)