#lynx-io_unexpected

1 messages · Page 1 of 1 (latest)

tribal remnantBOT
#

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

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

barren obsidian
#

Can you share some details about how you integrate today? Which APIs/UIs you're using to collect payments? Some code is helpful too!

rotund elk
#

Latest API and SDK

#

as for the code something like this

        return this.stripe.paymentIntents.create(
          {
            customer: customerId,
            payment_method: paymentMethodId,
            amount,
            currency: 'usd',
            confirmation_method: confirmationMethod,
            automatic_payment_methods: automaticPaymentMethods // this is true
barren obsidian
#

Can you share a pi_xxx ID with me?

#

And to confirm, the issue is Klarna is showing when it shouldn't be?

rotund elk
#

Yes correct, it should only show to people in USA but it's showing to everyone

#

from a test env or prod?

barren obsidian
#

Either, just a payment where the issue is evident

rotund elk
#

sure

#

one sec pls

tribal remnantBOT
rotund elk
#

deleted it, let me know if you got it well

barren obsidian
rotund elk
#

like this

barren obsidian
#

Yeah that won't work here as they dont support recurring payments:

Payment method rules won’t apply when a Payment Element, Express Checkout Element, Checkout or Payment Links integration creates a subscription. For more information about subscriptions and invoices, see How subscriptions work.

Control when payment methods are available to your buyers.

rotund elk
#

What do you mean? I've seen purchases of recurring payment products already

barren obsidian
#

The PI you shared is from a subscription/invoice. The rules don't work for those kind of payments, meaning if you've created a rule to restrict Klarna to USD and/or US-based customers it's ignored for this payment

rotund elk
#

I see. But the recurring payment still works fine right? I need to get his clear

barren obsidian
#

Well the example you shared was canceled as the invoice was voided. Otherwise I don't understand the question

rotund elk
#

You mentioned that they do NOT support recurring payments. However, I've seen actual customers (the one I shared was from internal employee) purchasing via Klarna subscription/invoice.

#

This is now a different question

#

Will the renewal ocurr correctly?

barren obsidian
#

You're conflating what I'm saying. Klarna does support recurring payments

I'm telling you that the rules you're using to limit Klarna payments to non-US customers do not work for recurring payments

rotund elk
#

Gotcha, now I understood

#

Thank your for clarifying that and your patience. Is there a way around this?

barren obsidian
#

In any case, I'm surprised Klarna is rendering in the Payment Element unless you are deemed to be US based (via IP address)

#

It's not a cross-border payment method so it should be automatically filtered

rotund elk
#

That's my concern as well, hence reaching out here. I feel like there might be a bug somewhere

barren obsidian
#

Checking something

rotund elk
#

👍

barren obsidian
rotund elk
#

Let me recheck that

barren obsidian
#

Can you reproduce this exactly issue now and share an example? I can't find any logs for pi_3T4jwjB2MMvRpXYf1V44KaUP from 2/25

rotund elk
#

This is for the subscription one. We call this when calling /prepare to prepare the payment and get the paymentIntentSecret

    return this.callStripe(
      async () => {
        const ret = await this.stripe.subscriptions.create(
          {
            customer: customerId,
            default_payment_method: paymentMethodId,
            items: priceIds.map((id) => {
              return { price: id };
            }),
            collection_method: 'charge_automatically',
            payment_settings: setPaymentMethodOnSubscribe
              ? { save_default_payment_method: 'on_subscription' }
              : undefined,
            payment_behavior: paymentBehavior || 'allow_incomplete',
            discounts: coupon ? [{ coupon }] : undefined,
            metadata,
            expand: [
              'latest_invoice.payments',
              'latest_invoice.confirmation_secret',
            ],
          },
          {
            idempotencyKey,
          },
        );

        return ret as StripeSubscriptionWithLatestInvoice;
      },
      'creating subscription',
      idempotencyKey,
    );

barren obsidian
#

I mean you're passing default_payment_method here so this all seems moot? Why would you render a UI to collect payment details if you already have some? In that example above we'd immediately attempt payment with the provided pm_xxx

#

I'd love to get an example pi_xxx from now where Klarna, in your opinion, renders unexpectedly. As I said that shouldn't happen unless we think you/the customers is located domestically (e.g. in the US)

rotund elk
#

It might be null that paymentMethodId

#

Sure

#

Seems like when in the code the default_payment_method is undefined or null, it creates a default address to US by Stripe, hence showing Klarna?

#

I am not in the USA btw, not even in America continent

barren obsidian
#

Can you share a screenshot for the payment UI? Also all the code you use to init the Stripe.js/Payment Element

rotund elk
#

Checking the bit for payment element

#

bear with me because im not a FE guy

barren obsidian
#

Ah, looks like your account is actually configured to support this (US -> EU customers with Klarna)

rotund elk
#

Yes, but still it's showing to people in KSA for example and Philippines

#

when it shouldn't

barren obsidian
#

Not sure how relevant? API version is not the cause

rotund elk
#

sorry I was using the italy vpn one second

#

I don't know, I was just sharing it

#

I also spotted this

function getPaymentElementOptions(
        registrationState: RegistrationState
    ): ComponentProps<PaymentElement>["options"] {
        return effectSafeParseSessionStorageIntentData(registrationState).pipe(
            Option.flatMap((data) => {
                const postalCode = data.isBillingAddressSame ? data.zip : data.billingZip;
                return postalCode?.trim()
                    ? Option.some({
                          // See https://docs.stripe.com/js/elements_object/create_payment_element
                          terms: {
                              card: "never",
                          },
                          defaultValues: {
                              billingDetails: {
                                  address: { postal_code: postalCode },
                              },
                          },
                      } satisfies ComponentProps<PaymentElement>["options"])
                    : Option.none();
            }),
            Option.getOrNull
        );
    }```
barren obsidian
#

Checking

rotund elk
#

I noticed that in the payment intent -> payment method, is empty before I proceed with clicking Klarna in the FE. And as soon as I click Klarna, it adds "US"

#

But even with empty address, below it says "allowed payment methods: klarna card"

barren obsidian
#

Yeah the Payment Element will list all the supported billing countriues in the dropdown. What is surprising to me is that we don't apply IP based filtering to remove Klarna as an option given you're in KSA and it shouldn't be supported. It's unclear if this is expected, or a bug

I'd probably recommend you write in to my team directly and we can do a deeper investigation and work with Klarna team to understand the issue

tribal remnantBOT
#

Hello @rotund elk, we have sent you a direct message, please check it at https://discord.com/channels/@me/1477998906527846453

  • 🔗The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
rotund elk
#

Alrighty, thank you!

tribal remnantBOT
nocturne forum
#

@rotund elk please let us know when you do so that we close this thread

rotund elk
#

i went to the ai assistant and told it "yes', i think that was enough right?

barren obsidian
#

Yep, we've got it. Will reply via email

rotund elk
#

i didn't add any extra details, i hope it got everything from discord