#MarcusStripe

1 messages ยท Page 1 of 1 (latest)

open agateBOT
exotic inlet
#

๐Ÿ‘‹ happy to help

vital brook
#

thanks

exotic inlet
#

I'm not really following, let's forget a bit about the implementation and just focus on the use-case

#

could you please describe what are you trying to achieve here?

vital brook
#

We have a product, with a price id. the price is a one time price / product

#

customer with an existing subscription and existing payment method, can buy those items additionally

#

(mutiple times)

#

we have a 3D secure requirement also

#

I was told to buy those one time products, I would have to create an invoice

#

I want the payment to be done immediately with an extra invoice -

#

not have the one time item added tot eh invoice at the end of the period

#

and I think I need a secret for the client / ui to confirm the payment

exotic inlet
vital brook
#

it should not be added to the subscription.. it should be a ONE time payment

exotic inlet
#

with prorations none and billing_cycle_anchor unchanged

vital brook
#

and it should be paid immediately

exotic inlet
vital brook
#

hm.. difficult. you are basically telling me to do something entirely different than what was told to me - here - before.
Why not using the invoice create api? Any good reason not to?

#

and I checked it:
add_invoice_items optional array of hashes

A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription.

#

As I wrote - that is NOT what I want

exotic inlet
#

no not really but you mentioned this

customer with an existing subscription and existing payment method, can buy those items additionally
which got me thinking about our add_invoice_items which is exactly for this use case

vital brook
#

e.g. I have a subscription from 15.-15. Today is the 7th, and right now I want to buy a new one time item

#

and in the future, this might also be bought without a subscription

exotic inlet
#

if you combine add_invoice_items with prorations none and billing_cycle_anchor unchanged you will get what you want

vital brook
#

so if bought on the u7th, the payment should be done immediately

#

an extra invoice should be sent to the customer

exotic inlet
#

why not just treat them separately

vital brook
#

ok then maybe I confused you

#

sorry ๐Ÿ˜‰

#

I just wanted to say.. I hope the subscripion will not get in the way in some way

#

it should be handled separatly, but the fact is there may be additional a subscription

exotic inlet
#

if these are add-ons to the subscription I really recommend using my method

vital brook
#

and in any case, I asume that the payment method is ready

vital brook
#

those one time payments - you can buy support time, e.g

#

there may - or may not - be a subscription

#

but the customer can buy extra customer support

#

so I pay you 100 USD and then I got the right to call you

exotic inlet
#

if the support is related to the subscription then using the add_invoice_items would mean that you would get an invoice linked to that subscription which is paid immediately and that doesn't change the cycle of the subscription (when using the above mentioned params)

#

if you the support isn't related to that subscription then you can use the create invoice API to do so separately

vital brook
#

but, as I said, I dont want it linked, especially not because, at a later time, we want to allow to buy one time payments without having any subscriptions

#

so I did:
Invoice.create(
InvoiceCreateParams.builder()
.setCustomer(stripeCustomerId)
.setCollectionMethod(InvoiceCreateParams.CollectionMethod.CHARGE_AUTOMATICALLY)
.setDaysUntilDue(0L).build()

exotic inlet
#

I just wanted to make that point clear before proceeding

#

in that case why are you using charge_automatically when you went the invoice to be sent to the user and have them pay it?

vital brook
#

thats how I was told to do.. but following the errors I get.. it is and seems logically wrong

#

I do the next call as:
InvoiceItem invoiceItem = InvoiceItem.create(InvoiceItemCreateParams.builder()
.setCustomer(stripeCustomerId)
.setPrice(stripePriceId)
.setInvoice(invoice.getId())

#

and the last call was:
invoice.sendInvoice(InvoiceSendInvoiceParams.builder()
.addExpand("payment_intent")
.build(), requestOptions);

#

I need a payment intent.. or at least I think I do?

#

to confirm the one time payment

#

in the client

exotic inlet
#

just a second please

#

let's forget about the code again for a sec here, how do you want your customer to pay the invoice? do you want to use the already existing payment method? do you want them to come back to your website and have them enter the payment details? or do you want them to go to our Hosted Invoice page and pay it there?

vital brook
#

do you want to use the already existing payment method?

#

yes

#

do you want them to come back to your website and have them enter the payment details?

#

the user themselves click a BUY NOW button

#

they are online at the time

#

so you click buy - and confirm the payment with your 3d secure method just in time

exotic inlet
#

ok you might not need 3DS

vital brook
#

that's why it said "CHARGE_AUTOMATICALLY"

#

but it doesnt like the invoice part in that case

#

ok you might not need 3DS
This I dont know. I just want stripe to give all whatever necessary to the client so the client can finish up the payment while online

#

and when the payment is done, I expect an invoice to be send to the customer, and I will listen to the event for a manual invoice so I can ACTIVATE that product as bought in my backend

exotic inlet
#

why are you sending the invoice? that part I haven't figured out yet

exotic inlet
vital brook
#

ok. what alternative ?

exotic inlet
#

you'd have to send the invoice yourself

vital brook
#

If I charge money from you, I guess you'd expect an invoice?

exotic inlet
#

or send the receipt instead

vital brook
#

you are confusing me. Let's go slow.

#
  1. how would it work without sending an invocie??
exotic inlet
#

it just does because you're charging them automatically

vital brook
#

for any money flying arround, we need some kind of paper as a proof

exotic inlet
#

but as I said you can send them a receipt

vital brook
#

how's that actually different?

exotic inlet
#

an Invoice means that you need money from someone and they need to pay it. a receipt means that someone already paid you for something

vital brook
#

yeah this differnece I know

#

and still... in the digital world.. this difference is not really a (big) difference at all

#

I just googled the case for Germany. It says receipt only work up to 150 Euro

#

so I would be definitely saver with an invoice

#

so I would say - hey customer you want - PRODUCT - here is the INVOICE - and then I charge the invoice directly.

#

somehow... right?

#

I mean thats also how it works with the subscriptions

#

there are invoices, and they are charged by stripe automatically

#

so I want a similar behaviour

atomic dirge
#

To be clear, an invoice will be sent to users following payment of a charge_automatically invoice (assuming you have receipts turned on)

#

There'll be a link in the email, like this:

vital brook
#

so.. I should use charge automatically, as I did

#

but then.. should I also call send invoice.. or not.. it doesnt seem to work

atomic dirge
#

What doesn't seem to work?

vital brook
#

well so far I had -

#

create invocie with CHARGE automatically

#

then - create invoice item - add the price to charge for

#

then - send invoice

#

and this gave me an exception

atomic dirge
#

What's the error?

vital brook
#

I got:
You can only specify 'due_date' or 'days_until_due' if invoice collection method is 'send_invoice'.; request-id: req_W0WUSJvQy8lgcd

atomic dirge
#

I guess you can't call that endpoint with charge_automatically

vital brook
#

Then, I removed that, and got:
You can only manually send an invoice if its collection method is 'send_invoice'.; request-id: req_goPNULhYs84vV5

atomic dirge
#

Yep, as stated:

To be clear, an invoice will be sent to users following payment of a charge_automatically invoice (assuming you have receipts turned on)

#

So you don't need to manually call the endpoint to send the invoice

vital brook
#

and the payment intent that i need -

#

befgore, I added it to send Invoice

#

now if I remove that

#

I would instead do:
private Invoice createInvoice(String stripeCustomerId) throws StripeException {
return Invoice.create(InvoiceCreateParams.builder()
.setCustomer(stripeCustomerId)
.setCollectionMethod(InvoiceCreateParams.CollectionMethod.CHARGE_AUTOMATICALLY)
.addExpand("payment_intent")
.build(), requestOptions);
}

#

yes?

#

adding the payment intent expand to the create invoice call

#

to return the payment intent to the client

#

to confirm the payment

atomic dirge
#

Yep, exactly

#

That's assuming your customer is on-session to do the confirmation

vital brook
#

ok

#

great, finally solved ๐Ÿ™‚

#

one more, other thing

#

(entirely different!)

#

we want to add additional payment methods

#

the payment method is added on-session of course.. in the client

#

the client AFAIK adds it - but needs a secret for confirmation -

#

is that a payment intent or a setup intent?

#

--
We used a payment intent and this failed with:
: Missing required param: amount.; code: parameter_missing; request-id: req_2EMXHNYWGDXCrv

atomic dirge
#

Is it simply to setup a card for future payments? There's no actual initial payment?

vital brook
#

yeah

#

it is just to be abel to swithc a card that is about to expire

#

so - add a new card for later -

#

make it the primary card -

atomic dirge
vital brook
#

remove the old card

atomic dirge
#

Let me know if you have any follow-up Qs about that doc