#zhyga_code

1 messages ¡ Page 1 of 1 (latest)

cold bluffBOT
#

👋 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/1299315213123981374

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

placid galleon
#

Could you please share the PaymentIntent Id used ?

frail marsh
#

my typo "Bank Transfer", not Bank Acount. Its not possible to pay via Bank Transfer.

#

checking PaymentIntent Id. Give me a moment

#

pi_3QDkcVRwTRvw88Wo05BQHUfq

placid galleon
#

Thanks, checking...

#

I see those PaymentMethods enabled for that PaymentIntent card, sepa_debit and customer_balance which is bank transfer

#

Can you share a screen shot of your PaymentElement ?

frail marsh
#

Invoice its a our custom form calling POST /v1/invoices

#

we would like to use

placid galleon
#

When opening the dev tool

#

Are you seeing any particular log line?

#

Do you have a hosted test website, that we can use ?

frail marsh
#

yes, we have

#

let me send it to you

placid galleon
#

Thanks

#

Now can you share with me the checkout url ?

placid galleon
#

Are you using the deferred mode here ?

#

Its seems you are not using the PaymentIntent generated with the customer_balance, but you are using the deferred approach.

#

is there a particular reason for that ?

frail marsh
#

moment, checking

#

this is my code on BE to create PI on Stripe fun createPaymentIntent(userId: String, customerId: String, basket: BasketOutput): PaymentIntentOutput? {
return try {
val params = PaymentIntentCreateParams.builder()
.setCustomer(customerId)
.setAmount(basket.total)
.setCurrency(basket.selectedPackage?.defaultPrice?.currency ?: StripeProxyConstants.CURRENCY_EUR)
.putMetadata("basketId", basket.id)
.putMetadata("userId", userId)
.build()

        val intent = PaymentIntent.create(params)

        PaymentIntentOutput(intent.id, intent.metadata["basketId"] ?: "unknown", intent.clientSecret)
    } catch (e: StripeException) {
        logger.error("Error during payment intent creation for Stripe: ${e.message}")
        null
    }
}
#

we havent used PaymentIntent generated with the customer_balance.

#
  1. we create PI 2. Crete a method of payment. 3.Confirming payment intent
placid galleon
#

Why you are not using the Payment Intent created in the PaymentElement?

frail marsh
#

because to draw this element we needed to pass clientSecret. So we call create paymentIntent throug our payment proxy, where we receive clientSecret. We use it for payment element. Then we create method of payment, and confirm intent wiith this MOP.

#

did we do smth wrong?

placid galleon
#

So we call create paymentIntent throug our payment proxy, where we receive clientSecret.
Yes great, but why you are not using the clientSecret with the PaymentElement then ?

frail marsh
#

yes, we do

placid galleon
#

According to the code you've shared no you aren't actually

#

Can you please share where in the frontend you are using the clientSecret with the PaymentElement ?

frail marsh
#

moment

cold bluffBOT
placid galleon
#

You should set the clientSecret in your stripeOptions instead of passing the amount, mode, and currency

frail marsh
#

so, 1 create paymentIntent using backendProxy. 2. clientSecretFrom step 1 should be passed to PaymentElement instead of nstead of passing the amount, mode, and currency.

#

what will be step 3?

supple ferry
#

you'd call confirmPayment

frail marsh
#

so the problem is in the code. if i eliminate this problem, Bank Transfer should be present automatically

supple ferry
#

I don't know really, I answered your last question. Can you share a pi_xxx ID that you're creating?

frail marsh
#

pi_3QDkcVRwTRvw88Wo05BQHUfq

supple ferry
#

Can you remove the paymentMethodCreation line? Is that necessary (I don't think it is based on what you've shared)

#

(in fact just remove all those options params other than clientSecret)

frail marsh
#

if i remove it, i wont be able to retrieve paymentMethod on frontend

#

without paymentMethodCreation i woulnt be able to call PI confirm

supple ferry
#

You only need to create the PM explicitly like that if you want to send it server-side to process some logic on it

frail marsh
#

we do payment confirm via our paymentProxy backend. What you recomend to do it from fe to Stripe stripe.confirmPayment, right?

supple ferry
#

You seem to be mixing a deferred and non-deferred integration and it's probably confusing the payment method logic. If you're creating the intent before you initialise the Payment Element then you only need to pass clientSecret and then pass elements to confirmPayment

supple ferry
frail marsh
#

thank you very much

#

we will adjust paymentConfirm