#jean-baptiste-r_code
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/1329775528756117564
π Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jean-baptiste-r_code, 1 hour ago, 38 messages
hi there!
how are you accepting payments? Checkout Session, Payment Element, something else?
Hey, gonne give you code and screenshots I couldn't send in the form :x
I don't really need the code for now
Hello π
I was implementing the solution that tarzan gave me: https://discord.com/channels/841573134531821608/1329729155478196257
Here my frontend code:
const elements: StripeElements | undefined = stripeJs.elements({
mode: 'setup',
currency: 'eur',
payment_method_types: ['card', 'customer_balance', 'sepa_debit']
})
const paymentElement: StripePaymentElement | undefined = elements.create('payment')
paymentElement.mount(elementWrapper)
And here is my backend code:
public createPaymentIntent(payload: IPaymentIntentPayload): DataWrapper<Promise<IPaymentResponse>> {
const paymentIntentPromise = (async (): Promise<IPaymentResponse> => {
const stripe = this._stripe[payload.vmcCompanyAccountName]
const createdPaymentIntent = await stripe.paymentIntents.create({
amount: Math.round(payload.amountInEuros * 100),
currency: payload.currency || 'eur',
customer: payload.customerId,
payment_method: payload.creditCardId,
payment_method_options: {
card: {
setup_future_usage: payload.setupFutureUsage,
},
sepa_debit: {
setup_future_usage: payload.setupFutureUsage,
},
},
automatic_payment_methods: {
enabled: true,
},
confirm: payload.confirm || false,
metadata: {
...payload.documentData,
...(payload.metadata || {}),
},
})
// convert payment intent to inner response format
return {
paymentIdClientSecret: createdPaymentIntent.client_secret || undefined,
status: this.convertStripeStatusesToPaymentProviderStatuses(createdPaymentIntent.status),
paymentId: createdPaymentIntent.id,
}
})()
return DataWrapper.fromData(paymentIntentPromise)
}
So I'm not using the payment_method_types property anymore. If I'm right, this means that I'm handling payment thanks to the Stripe Dashboard.
So I got to the dashboard and added bank transfers as a payment method. But on my application, I can't see the bank transfer.
Ah, well sorry, here is if needed π
thanks for the details, having a look
Just checked to be sure: I'm using the test keys and I activated the payment method in test mode
I'm a bit confused. if you are creating a PaymentIntent, why use mode: 'setup'?
This code is used to setup the HTML Element from Stripe
no. mode:setup means you are trying to save the payment method without making a payment.
Euh
So I'm not in the right code
Oh true, I was modifying the wrong code !
Okay, so here is the right code:
const elements: StripeElements = stripeJs.elements({
mode: 'payment',
currency: 'eur',
amount: Math.round(amount * 100)
})
const paymentElement: StripePaymentElement = elements.create('payment')
paymentElement.mount(elementWrapper)
When adding payment_method_types: ['card', 'customer_balance'], there is a new choice for bank transfer.
Why it doesn't show my this choice without this line then ?
I don't know if my message if really understandable...
Here are examples:
With this code:
const elements: StripeElements = stripeJs.elements({
mode: 'payment',
currency: 'eur',
amount: Math.round(amount * 100)
})
const paymentElement: StripePaymentElement = elements.create('payment')
paymentElement.mount(elementWrapper)
I'm not using the payment_method_types property, so Stripe should automatically show the payment methods. But it doesn't show the bank transfer method. (first screenshot)
When I had the payment_method_types property like this:
const elements: StripeElements = stripeJs.elements({
mode: 'payment',
currency: 'eur',
amount: Math.round(amount * 100),
payment_method_types: ['card', 'customer_balance']
})
const paymentElement: StripePaymentElement = elements.create('payment')
paymentElement.mount(elementWrapper)
Now, I can see the bank transfer method... (second screenshot)
But I don't want to use the payment_method_types property, I'd like to handle my payment methods with the dashboard.
Welcome π
What's your acct_xxx ID?
To confirm, you're unclear why bank transfer PM is missing from your Payment Element?
Exactly
Ah, ok. This is a Connect setup? Can you show me how you're initialising Stripe.js?
public static getStripeJs = async (companyProfile: EStripePublicKeyEnv): Promise<Stripe> => {
const stripePublicKey = useConfig().get(companyProfile)
/* eslint-disable */
if (!StripeHelper.stripeJsInstancesMap.get(companyProfile)) StripeHelper.stripeJsInstancesMap.set(companyProfile, await loadStripe(stripePublicKey))
if (!StripeHelper.stripeJsInstancesMap.get(companyProfile)) throw new Error('Erreur lors du chargement de Stripe')
/* eslint-enable */
return StripeHelper.stripeJsInstancesMap.get(companyProfile) as Stripe // Cast as Stripe because it cannot be null here
}
(I need to handle multiple Stripe JS instance, so that's why there's a map. Stripe.js is initialised using await loadStripe(stripePublicKey))
OK, thanks. What about an example pi_xxx you create?
Here is: pi_3QiCiGFrwhyGApwd0xEiBgzy
I created it this morning and use the SEPA method
But for the bank transfer method, I create my payment intent in my backend application, so after clicking in the "confirm payment" button... so I don't have payment intent for this method
Yeah you're using the deferred intent flow in the code above
Is there somewhere I can reproduce this?
Sadly no sorry π¦
I can't give you the app source code, it's not my property
Or, can you do me a favour and refresh the page where you have the Payment Element and remove the payment_method_types param so it uses the Dashboard configf
Done. The result is the same as mentionned above
Don't hesitate to ask anything that could help you π
Hmm, are you using your live pk_xxx key with Stripe.js?
I hope I don't π§
Lemme check
Seems like it...
I wonder if that is influencing things somehow. That's literally all I can think of right now
I'm sure I'm using the right keys π
The logs indicate pk_live_xxx was passed in some scenarios. Not sure if/why that would affect available PMs, but you should be using test keys anyway
they start with pk_test_xxx and sk_test_xxx and values are correct
I guess you have an integration live on this account then?
Yes I do
Ah, ignore me then
I didn't mean the source code, btw. I meant a site I can visit to see the behaviour β via ngrok or something
Otherwise I'm at a loss β nothing in our logs to indicate the problem so I'd recommend you write in and we can take a further look async
Hello @scenic patrol, we have sent you a direct message, please check it at https://discord.com/channels/@me/1329797929132757161
- πThe message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
No problem, glad I could help!
OH, I know the problem
You need a Customer object associated with the payment/session in order for Bank Transfers to work:
You must associate a Customer object to reconcile each bank transfer payment. If you have an existing Customer object, you can skip this step. Otherwise, create a new Customer object.
Trying to figure out how that works in the deferred intent scenario
I don't think it works π¦
Assumed it may be possible via a Customer Session, but seemingly not: https://docs.stripe.com/api/customer_sessions