#manny-manny-2023_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
hi there!
hi soma, how are you
sure, you can save a payment method with Stripe, and charge it later.
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
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.
may be know how to achieve both if you do not mind please
for the first option: https://docs.stripe.com/payments/checkout/save-and-reuse
for the second option: https://docs.stripe.com/payments/place-a-hold-on-a-payment-method
we only have bank payments so we do not have card option, so 2nd wont work i think
yes placing a hols id mostly for card payments
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
i have to again write code to trigger it?
yes, this is covered at the end of the doc I shared
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
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.
ok
so i can collect the payment method and then after x days create a payment intent to charge it?
correct!
we only allow bank methods so micro deposit verification and everything works ahead of payment intent or after payment intent is created?
that would happen at the very beginning, when the payment method is created.
ok thank you so much that answers our question, thank you for your help, have a nice day
happy to help ๐