#josula_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/1359503175828377815
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐ happy to help
We are integrating Mondu right now and I want to confirm confirm a payment with mondu in my nextjs app. I updated all my stripe packages:
"@stripe/react-stripe-js": "3.6.0",
"@stripe/stripe-js": "7.0.0",
const form = document.getElementById('payment-form');
form.addEventListener('submit', async function(event) {
event.preventDefault();
// Set the clientSecret of the PaymentIntent
const { error } = await stripe.confirmPayment({
clientSecret: clientSecret,
confirmParams: {
payment_method_data: {
type: 'mondu',
},
// Return URL where the customer should be redirected after the authorization
return_url:
would you mind elaborating please
I follow above code taken from the docs.
did you activate Mondu on your account?
Mondu is a private preview feature
so if you don't have access to that feature you can't integrate
did you ask for access to this feature on this page https://docs.stripe.com/payments/mondu#:~:text=Interested in getting early access to Mondu%3F ?
Yes I have activated it! Even signed it with your CS to use it
But I get this type error and then run time error in my app:
No overload matches this call.
The last overload gave the following error.
Object literal may only specify known properties, and 'type' does not exist in type '{ billing_details?: BillingDetails | undefined; allow_redisplay?: "always" | "limited" | "unspecified" | undefined; }'.ts(2769)
payment-intents.d.ts(1532, 3): The expected type comes from property 'payment_method_data' which is declared here on type 'ConfirmPaymentData'
And then my stripe response:
No such PaymentMethod: 'mondu'
My inital thought was that the stripe package needs an update.
So either the docs are wrong / outdatet or my stripe version is too old or something else obv
would you mind sharing your account ID please
acct_1QolrzHqliFa6vlS
actually I just noticed, you don't have to pass payment_method_data: { type: 'mondu', }, when you confirm
you can automatically pass in the elements instance as you can see here https://docs.stripe.com/payments/mondu/accept-a-payment?web-or-mobile=web&payment-ui=elements#submit-the-payment
No we use the bare metal api
so we create an invoice, then attach the payment method to the payment intent and confirm it,
so at the time the payment intent is created we have no clue what the customer will choose
exactly why I advise you to follow the code snippet in that doc I sent
minus of course the intent creation call since you already have the PaymentIntent's client secret from the invoice
so you're not really using the PaymentElement?
<Elements stripe={stripePromise}>
<StripePaymentButton
customer={customer}
/>
</Elements>
This is our elements wrapper,
then on the button:
function getStripeConfirmationMethod(
stripe: Stripe,
clientSecret: string,
cart: HttpTypes.StoreCart,
countryCode: string
): Promise<PaymentIntentResult> {
switch (cart.metadata.payment?.type) {
case "card":
return stripe.confirmCardPayment(clientSecret)
case "paypal":
return stripe.confirmPayPalPayment(clientSecret, {
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/${countryCode}/order/status?cartId=${cart?.id}`,
})
case "sofort":
return stripe.confirmSofortPayment(clientSecret, {
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/${countryCode}/order/status?cartId=${cart?.id}`,
})
case "sepa_debit":
return stripe.confirmSepaDebitPayment(clientSecret, {
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/${countryCode}/order/status?cartId=${cart?.id}`,
})
case "invoice":
return stripe.confirmPayment({
clientSecret: clientSecret,
confirmParams: {
return_url: `${window.location.href}`,
},
})
PaymentElement => we use the bare metal stripe api as I said
the "invoice" case is the one i want to be handled by mondu
the last case basically
so you're using your own UI to let your customer decide which payment method they'll use, right?
in that case you can use confirmMonduPayment
Property 'confirmMonduPayment' does not exist on type 'Stripe'. Did you mean 'confirmPayment'?ts(2551)
return stripe.confirmMonduPayment({
clientSecret: clientSecret,
confirmParams: {
return_url: `${window.location.href}`,
},
})
This is the code
which stripe-js version are you using?
Property 'confirmMonduPayment' does not exist on type 'Stripe'. Did you mean 'confirmPayment'?ts(2551)
try to#ts-ignorethis and run it
it should work
you can search for confirmMonduPayment payment here https://js.stripe.com/basil/stripe.js and you can see that it exists so you don't have to worry
ok great! Will try
the issue is that https://github.com/stripe/stripe-js/blob/v7.0.0/types/stripe-js/payment-intents.d.ts doesn't include confirmMonduPayment most probably because it's a private preview feature
Where do I get my beta flag from in stripe?
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_KEY!, {
betas: ["mondu_beta"],
})
mondu_beta is just a placeholder right now
I don't think it needs a beta
IntegrationError: You cannot call `stripe.confirmMonduPayment` without supplying an appropriate beta flag when initializing Stripe.js.
I do need it
๐
it's weird it's not mentioned here https://docs.stripe.com/payments/mondu/accept-a-payment?web-or-mobile=web&payment-ui=elements&lang=node#submit-the-payment:~:text=Create an instance of Stripe with the following JavaScript on your checkout page%3A
where it normally should be
the tag works! but now I get this issue:
Invalid value for stripe.confirmMonduPayment intent secret: value should be a client_secret string. You specified: {"clientSecret":"<STRIPE CLIENT SECRET","confirmParams":{"return_url":"http://localhost:8000/de/order/status?cartId=abc"}}.
Its quite hard without types or docs to debug.
Any idea?
stripe
.confirmMonduPayment({
clientSecret: clientSecret,
confirmParams: {
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/${countryCode}/order/status?cartId=${cart?.id}`,
},
})
Am I missing anything?
Hi there ๐ are you logging the contents of your clientSecret variable just before that error is thrown? Based on the error, it looks like that variable is holidng the string <STRIPE CLIENT SECRET instead of an actual client-secret from an intent.
Kind of a gray area. Those secrets are, well, secrets. But if you're doing everything in testmode then there aren't any real risks of sharing it. Worst case scenario some confirms that testmode payment.
"pi_3RByCIQWc5EeQut91qRfPebS_secret_O8tLQFfi7samq1PMdCQNQFu87"
thats the secret
it works with all other confirmPayment() calls we make (e.g. paypal or sofort)
Is it safe to assume the string value itself doesn't contain the double quotes you included?
Invalid value for stripe.confirmMonduPayment intent secret: value should be a client_secret string. You specified: {"clientSecret":"pi_3RByCIQWc5EeQut91qRfPebS_secret_O8tLQFfi7samq1PMdCQNQFu87","confirmParams":{"return_url":"http://localhost:8000/de/order/status?cartId=cart_abc"}}.
Were you given a support contact when you were being granted access to this private preview feature? I'd suggest reaching out to them about the expected behavior of this type of payment method and to raise these issues to them.
We aren't super familiar with implementing features that aren't generally available in this forum.
I figured it out
thanks!
Sorry one more question: Is there any description anywhere what the confirmMonduPaymentI() expects? I am guessing it here without types and docs
E.g. below throws an error:
stripe
.confirmMonduPayment(clientSecret, {
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/${countryCode}/order/status?cartId=${cart?.id}`,
payment_method: {
type: "mondu",
},
})
Error:
ERROR IN INVOICE IntegrationError: Missing value for confirmMonduPayment: payment_method.mondu should be an object or element.
Not that I'm seeing, but that's a good question for the support contact for this private preview feature if you were given a contact when being given access to this beta.
In the Mondu guide we seem to recommend confirmPayment rather than confirmMonduPayment. Were you given guidance to implement this differently than the guide shows?
I think you should raise all of this feedback to the beta contact so they can review their documentation and ensure it's accurate/complete.
well look above what tarzan wrote...