#dzidor-draft-invoice

1 messages ยท Page 1 of 1 (latest)

torn parcel
#

hey there sorry i missed this one

#

whats the actual error you're encountering?

#

Can you share a request ID?

#
peak orchid
#

what i need is that apply discount on subscription invoice for a customer

#

let's say the customer have 5 coupons of 30 USD. and he as a subscription plan in my website for 100 USD by month

torn parcel
#

Sure and you've shared a snippet of code. Does it work?

peak orchid
#

i need to catch the webhook [invoice.created] while it is a draft invoice each of the 5 following months

#

and i soon i get the webhook, i want to create an invoice item (with 1 of the 5 coupon)

#

to apply discount to his 5 next months

#

do you see what i want to achieve?

#

i try when received the webhook invoice.created to achieve that but maybe it is not the right way of doing that

#

InvoiceItem::create([
'customer' => 'cus_XYZ',
'invoice' => 'in_XYZ,
'discounts' => ['coupon' => 'XYZ'],
]);

#

You must specify a currency, or specify a price or price_data Stripe\Exception\InvalidRequestException

#

this is my error

#

my request id:
req_KrO8eoxP2H0T9v

#

allo ?

torn parcel
#

hey there, just a sec looking again ๐Ÿ™‚

#

Then the discount will be applied to it