#dbjpanda
1 messages · Page 1 of 1 (latest)
Do Coupons not work in this case?
https://stripe.com/docs/billing/subscriptions/coupons?dashboard-or-api=api#discount-subscriptions
I don't want to use a coupon. Is it possible to directly add an amount to be deducted?
No. That's what coupons and discounts are for
Actually, hold on
You can create a negative Invoice Item to add that one-time credit
I was trying to add an invoice with negative value. But it doesn't take negative umber
add_invoice_items: [{
price_data: {
currency: 'inr',
unit_amount: -900,
product: 'prod_NerxLA7HNPeeKx'
},
quantity: 1,
}],
There you go. Looks like you found the answer
It says Invalid non-negative integer
const subscriptionSwitched = await stripe.subscriptions.update(
userData.current_plan.subscription_id,
{
items: [{
id: userData.current_plan.item_id,
price: price_id,
}],
proration_behavior: 'none',
add_invoice_items: [{
price_data: {
currency: 'inr',
unit_amount: '-900',
product: 'prod_NerxLA7HNPeeKx'
},
quantity: 1,
}],
payment_behavior: 'pending_if_incomplete',
expand: ['latest_invoice.payment_intent'],
billing_cycle_anchor : 'now'
},
);
@dense wharf ^^^
You can't create a negative Price. You have to use the amount attribute on the Invoice Item object
I could not get you. Can you modify above code?
const invoiceItem = await stripe.invoiceItems.create({
customer: 'cus_abc123',
amount: -100
currency: 'usd'
});
can't we directly add it inside stripe.subscriptions.update
Not as far as I know, because the Update+ Subscription API call only allows you to add a new Price