#Dooing
1 messages · Page 1 of 1 (latest)
Do you want this one time payment to be added to their next subscription payment or is this a completely separate thing?
completley separate
like, you are subscriped to the PRO plan of lets say Stripe, andnow you want to buy a cover design of some artist
So if the user has already selected which payment method to use, you can basically follow this doc https://stripe.com/docs/payments/save-and-reuse?platform=web#charge-saved-payment-method
Except you wouldn't be passing off_session=True if the user is actively on their browser and just approved the purchase
So how would the flow be - backend sending a payment intent to the client, or the client starting the payment and the backend sends afterwards the intend to the client?
--
Further - can these one time products be setup on the stripe dashboard and be referenced by an ID... or is it just an arbitrary amount that is charged?
How would the invoice be created by stripe in the later case (without knowing the name of the product)
Yeah that flow would work. It sounds like you want to create a one-off Invoice on your server (creating a payment intent wouldn't create an invoice)
Then you can pass that invoice's client secret to the client
And you can call confirmPayment client side using either a payment element or with the pm_123... ID of the payment intent that you already have saved to the user
No, ideally, the invoice is created by stripe and send to the customer directly by stripe
as we do for subscriptions
I Would like to avoid implementing that on our end
.setConfirm(true) - what's that for?
and how to set the name of the product?
and.. again.. is it just ab arbitrary amount... or can I set up one time payments in stripe and reference them?
Ah in that case, you can just create an invoice and set collection_method to send_invoice, then Stripe will email the invoice to your user as we would for a subscription's invoice https://stripe.com/docs/api/invoices/create#create_invoice-collection_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
In that doc setConfirm(true) is indicating that that payment intent will try to charge the user's card as soon as it is created
is it just ab arbitrary amount... or can I set up one time payments in stripe and reference them?
Can you explain what you mean here a bit more? You can set up these invoices with arbitrary or pre-set amounts if that is what you are asking
price_1LhDYdF2iEUqWxhTH7KrNWlA
I just created it as a one time paymeny in stripe.
so it seems that is possible
so now I would just have to reference this
Ah in that case, you can just create an invoice and set collection_method to send_invoice,
where exactly?
In the collection_method parameter of the create invoice call https://stripe.com/docs/api/invoices/create#create_invoice-collection_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
price_1LhDYdF2iEUqWxhTH7KrNWlA
I just created it as a one time paymeny in stripe.
so it seems that is possible
so now I would just have to reference this
--
Would be great if you could answer it all.
I dont know how to buy a one time product with the price id
PaymentIntentCreateParams.builder()
.setCurrency("eur")
.setAmount(1099)
.setPaymentMethod("{{PAYMENT_METHOD_ID}}")
.setCustomer(stripeCustomerId)
this just lets me charge an arbitrary amount
Yes, the payment intents API does not support the prices API at the moment. So for that API call, the only option is arbitrary amounts. You can of course base that amount on the amount of a price that you have created
And here is a doc on ho to do this with the Invoices API https://stripe.com/docs/invoicing/integration#create-invoice-code
? So why do I configure one time prices if I cannot then charge them also???
I assume we have a misunderstanding.
lets reset and try again.
So I have a one time price/product -price_1LhDYdF2iEUqWxhTH7KrNWlA
how can I buy this using the stripe api / java client
Resetting sounds like a good idea. So to confirm your needs, you want to do a one off charge to this user and just send them the receipt essentially?
yes. But using a product / price construct would be better than jsut typing an arbitrary amount because - a) that would be a bit more in control of the dashboard.. so the customer could set up prices and we would dynamically retrieve them and show them in the app... and also, this would allow for a description, name, and maybe also some extra meta data
otherwise, we would have to move all the logic into our database
In that case, I think creating a one-off invoice is the best way forward here. The invoice would allow you to use the price object and set a description+metadata on the invoice and its items https://stripe.com/docs/invoicing/integration#create-invoice-code
And the format of the email that the user gets will be the same as when they make a recurring subscription payment