#arpit-gupta_docs
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/1234588514264285244
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hey, apologies for the delay. Can you tell me more about what is not happening here? Is Stripe not making the initial charge or are we not refunding it?
From that doc, it sounds like Stripe will automatically define and charge the small amount. If you yourself specify the amount, then Stripe will think you want to charge that amount, I don't think we would know to refund it in that scenario.
Can you show me your code for creating the subscription and for creating the payment element?
When I'm passing amount as 0 in the payment element, only card payment method is loading instead of ideal and sepa debit. and when I'm passing the minimum amount it is loading but amount is not getting refunded from stripe.
function prepareStripePaymentElementOptions() {
const {
mode,
currency,
paymentMethodConfiguration,
paymentMethodOptions,
enableBNPL,
} = props.stripeOptions
let { amount } = props.stripeOptions
let captureMethod = 'automatic'
if (amount === 0) {
captureMethod = 'automatic'
amount = 1
if (props.stripeMinimumChargeAmount)
amount = props.stripeMinimumChargeAmount[currency?.toUpperCase()] || 1
}
const options: any = {
mode,
amount: amountInSmallestCurrency(amount, currency),
currency: currency,
setupFutureUsage: enableBNPL ? undefined : 'off_session',
captureMethod,
payment_method_configuration: paymentMethodConfiguration,
payment_method_options: paymentMethodOptions,
}
return options
}
This is the payment element setup function
gotcha, testing this out myself
If I pass amount to be 0 , then I get this error in the payment element:
v3:1 Uncaught (in promise) IntegrationError: Invalid value for elements.update(): amount must be greater than 0
Gotcha, still trying to figure this out on my side. Will get back with what I can find.
Sure
I'm confused as to what you're doing here. If the first invoice of a subscription is $0, then you should use the pending_setup_intent: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent to collect payment method details. You shouldn't attempt to charge them some minimum amount and then refund them.
@zealous lynx
What mode are you using when creating your payment element? After testing some more, I actually think the setup that you will want will be something like:
options = {
// clientSecret will be auto-filled by bob
appearance: {
theme: 'stripe',
},
mode: 'setup',
currency: 'eur',
setupFutureUsage: 'off_session'
}```
If you aren't taking payment up front, you will be confirming a SetupIntent, I think `subscription` mode is only for subscriptions where you are taking a payment up front
we are setting mode as 'payment' if its a onetime product and 'subscription' if it is a recurring product. On checkout page we can have both the products, and they can be free trial product also or chargable product also on the basis of whatever the user selects. So we can't set mode as setup only as the product can be chargabe also
Ah so that is why mode is a variable? And are you updating the elements object when the user switches between the one time product and the subscription?
yes according to the selection of products, mode value is changed
also in setup mode amount is not applicable
Correct, setup implies an amount of 0. Basically elements expects payment for one time payments, subscription for subscriptions with payments upfront, and setup for setting up a payment method without an immediate payment.
So I think the intended way to do this would be to switch to setup mode once the user puts in a coupon that reduces the amount to 0 or if you determine they should have a free trial on their subscription
Right. So in order to track subsequent subscription we need to create payment intent and for that we need to setup mode as subscription whetehr its trial also
Not sure what you mean there. If you don't have a payment upfront you will always be using a SetupIntent. There won't be a payment intent if there isn't a payment when the user is inputting their details
Payment intent cannot be created with setup mode and also how I'll track my subsequent subscriptions if payment intent isn't created
Right but suppose a user is buying a trial subscription then on backend we need to create a payment intent and save it in order to track the further details
๐ taking over but really struggling to understand what exactly is blocking you.
There is really no reason for you to create any PaymentIntent if you use our Billing product with our Subscriptions API
my use-case is if i want to sell 100% coupon product or trial subscription product then we use to charge 1 euro using manual capture method in stripe payment element options and then create payment intent and once the transaction was completed stripe would refund that 1 euro. But now in case of ideal and sepa debit payment method only automatic capture method is not supported. So how to manage the same thing in case of ideal and sepa debit
I have already integrated ideal and sepa debit and creating payment intent and everything is working fine when trasaction amount is greater than 0 but it is causing probeme in case of 0 amount transactions only
We actively discourage charging a 1โฌ fee that you refund. this is really against card networks ToS and breaks our rules if you are doing this just to check if the card is valid
So the best solution is to not do that really. Or switch to having a real paid trial where everyone has to pay 1โฌ upfront for the trial
We don't refund. Stripe automatically refunds it as it is being charged as minimum amount for transaction to process
I'm sorry but I don't understand what that sentnce could mean. Stripe doesn't refund anything unless you mean that you let the hold expire but that's the same thing I explained above in that case