#manny-manny-2023_api

1 messages ยท Page 1 of 1 (latest)

median cipherBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1427255881841643621

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

celest tiger
#

hi there!

fleet cobalt
#

hi soma, how are you

celest tiger
#

sure, you can save a payment method with Stripe, and charge it later.

fleet cobalt
#

so we usually do these checkout sessions to collect one time payments that are immediate, can we modify checkout session to delay the payment?

#

or how to approach this please guide

celest tiger
#

which one do you want:

  • save the card (no payments), and later make a payment. note that the payment may fail, for example because there a not enough funds
  • or place a hold of the card for a specific amount (meaning you reserve the funds, but don't actually take them now), and later actually capture the funds.
fleet cobalt
#

may be know how to achieve both if you do not mind please

celest tiger
fleet cobalt
#

we only have bank payments so we do not have card option, so 2nd wont work i think

celest tiger
#

yes placing a hols id mostly for card payments

fleet cobalt
#

ok for the first option i will just be creating a payment method right, to charge the same payment method i have to again write code to trigger it? or will stripe handle it automatically

celest tiger
#

i have to again write code to trigger it?
yes, this is covered at the end of the doc I shared

fleet cobalt
#

SessionCreateParams params = SessionCreateParams.builder()
.setPaymentMethodTypes(Arrays.asList("card"))
.setMode(SessionCreateParams.Mode.SUBSCRIPTION)
.setSuccessUrl("https://yourdomain.com/success") // Your success URL
.setCancelUrl("https://yourdomain.com/cancel") // Your cancel URL
.addLineItem(
LineItem.builder()
.setPriceData(
SessionCreateParams.LineItem.PriceData.builder()
.setCurrency("usd")
.setProductData(
SessionCreateParams.LineItem.PriceData.ProductData.builder()
.setName("Your Product Name")
.build()
)
.setUnitAmount(2000L) // Price in cents (e.g., $20.00)
.build()
)
.setQuantity(1L)
.build()
)
.setSubscriptionData(
SessionCreateParams.SubscriptionData.builder()
.setTrialPeriodDays(90) // Trial period of 90 days
.build()
)
.build();

#

will this code work out?

#

we are thinking of creating a subscription with trial period of 90 days and then cancelling it once payment is received, is there any better way to do it

celest tiger
#

I don't understand. if your goal is to save a payment method to chagre it once later, then why do you want to create a Subscription?

#

instead, you shoulf follow the documentation I shared, that use a Checkout Session in setup mode.

fleet cobalt
#

ok

#

so i can collect the payment method and then after x days create a payment intent to charge it?

celest tiger
#

correct!

fleet cobalt
#

we only allow bank methods so micro deposit verification and everything works ahead of payment intent or after payment intent is created?

celest tiger
#

that would happen at the very beginning, when the payment method is created.

fleet cobalt
#

ok thank you so much that answers our question, thank you for your help, have a nice day

celest tiger
#

happy to help ๐Ÿ™‚