#KarlS-Invoice

1 messages · Page 1 of 1 (latest)

severe raven
#

Hi there, what's the other question?

torpid marsh
#

It came through...

#

The other question: with invoices how do you discount with a PROMO code?

#

*with invoice items

#

I can only see that you can discount with a Coupon.

severe raven
#

so you want to apply coupons to a specific set of products in the invoice?

torpid marsh
#

Well, I'm confused because I was use to applying PROMO codes to subscriptions.

#

I don't see the equivalence with Invoice Items. I get that you have to discount the Invoice Item. I don't see a way to discount at the Invoice level.

severe raven
#

Hmm, maybe you can tell me what you want to achieve with coupon?

torpid marsh
#

That is just it, that is the confusion! With an invoice item, is the only way to offer a customer a discount with a Coupon or can you also .... WAIT .... THINKING ....

severe raven
torpid marsh
#

OK, but Subscriptions is not correct. I'm charging for Products, one-time paid.

#

What are Promotion Codes used for and can my customers use them when they pay for one-time products?

#

(not subscriptions)

severe raven
#

Well you can apply coupon in many levels, such as customer, subscription, invoice and even invoice items.

torpid marsh
#

OK, I didn't see where you can apply it on an invoice. Can you shed some light on this?

#

never mind. i found it.

severe raven
torpid marsh
#

For the record: I see no way to process or redeem a Promotion code, only a Coupon when processing discounts on invoices and invoice items. I wish you would verfiy that.

severe raven
#

The difference between coupon and promo code is that coupon is merchant-facing, whereas promo-code is customer-facing.

#

So what's your use case here? you want your customer to enter a promo code when renewing the subscription?

torpid marsh
#

Yes, I want my customer to enter a promo code, but not for a subscription, for their invoice that they are paying.

severe raven
#

I see, I'm afraid the the hosted invoice page doesn't accept promo code.

torpid marsh
#

I'm in the API and am not finding support for it either.

severe raven
#

Ok, let me rephrase, you can add a coupon when creating an invoice and that discount will be automatically applied to the invoice. However, the invoice page doesn't support promo code, so that your customer can't enter a promo code in the invoice page to enjoy a discount.

torpid marsh
#

Right, nor can you programmitically with the API apply a PROMO code anywhere for an invoice.

severe raven
#

I mean you can apply coupon to invoice.

Promo code is customer-facing, something that you customer need to input.

torpid marsh
#

so the only thing you can do with the PROMO code is use it on the backend to find the COUPON code which you then use to discount the invoice.

severe raven
#

Hmm, I'll say using coupon to apply discount to invoice.

torpid marsh
#

see there difference with Subscriptions? Here it is:

SubscriptionCreateOptions.PromotionCode = <promotion code id>

severe raven
torpid marsh
#

Yes! I'm just pointing out the differences is all. I am now resolving a PROMO code to a COUPON in my backend and applying to the invoice.

#

Thanks!

severe raven
#

Cool! happy to help

torpid marsh
#

Sure thing

severe raven
#

Can you show me the code?

torpid marsh
#

its a lot of code.

severe raven
#

the relevant code will do

torpid marsh
#

Um.. trying to imagine best way to show you.

#

ok, 1 sec.. just copy/paste here?

severe raven
#

Walk me through with an example if you can

torpid marsh
#

yep, hold on.

#

see this invoice in_1Kg1a5G30Vl6ne6Nuzvsd4yR

#

(assuming you are the only one who can see this, it is in test, but like the names are real)

severe raven
#

Only Stripe engineers can see, so don't worry

torpid marsh
#

i thought so

#

so I had something in my code that was throwing an exception.

#

after a couple of tries at fixing it, I got it fixed and on my last try the Payment was received and processed. well and you can see that the invoice line items were in multiples!

#

expecting..

in_1Kg1eyG30Vl6ne6NFHlvAMIi

severe raven
#

OK, so your code added multiple invoice items but it suppose to add one item only, am I right?

torpid marsh
#

yes. like i said, I was debugging something that was broke and on the 4th or 5th try it went through... is there a way to prevent these invoices drafts from lingering?

severe raven
#

ok, I'd suggest you to finalize the invoice once you have added the item, so that this invoice cannot be changed anymore.

torpid marsh
#

ok... how about if there is an unhandled code exception, can I invoke some sort of destroy or terminate on the invoice that is not yet finalized?

severe raven
#

what kind of exception?

torpid marsh
#

anything... even my own exception, so not stripe related.

#

I see a need to abandon any outstanding invoices at this point

severe raven
torpid marsh
#

ok, that should work.

#

thank you

torpid marsh
#

I'm able to reproduce the problem