#lkb2k_reactnative-paymentsheet

1 messages ¡ Page 1 of 1 (latest)

cold ridgeBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1245877423149551696

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

minor blade
#

client_secret: "<redacted>"
payment_method_data[billing_details][address][country]: "US"
payment_method_data[billing_details][address][postal_code]: "10101"
payment_method_data[card][cvc]: "123"
payment_method_data[card][exp_month]: "4"
payment_method_data[card][exp_year]: "25"
payment_method_data[card][number]: "4242424242424242"
payment_method_data[payment_user_agent]: "stripe-ios/23.18.3; variant.legacy; PaymentSheet"
payment_method_data[type]: "card"
use_stripe_sdk: "true"

#

response:
{
"id": "seti_1PMHyCDFLdjPQhScR179sHlF",
"object": "setup_intent",
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "<redacted>",
"created": 1717110076,
"description": null,
"last_setup_error": null,
"livemode": false,
"next_action": null,
"payment_method": "pm_1PMHyODFLdjPQhScxQT5wEeF",
"payment_method_configuration_details": null,
"payment_method_types": ["card", "card_present"],
"status": "succeeded",
"usage": "off_session"
}

#

SDK error: {
"error": {
"code": "Failed",
"declineCode": null,
"localizedMessage": "Card details not complete",
"message": "Card details not complete",
"stripeErrorCode": null,
"type": null
}
}

undone pewter
#

Give me a few minutes to catch up

#

Can you share some exact code and what part of the code raises that error?

minor blade
#

yeah, one sec. Let me get one of the other devs on also

#

const {error} = await initPaymentSheet({
merchantDisplayName: translate('cdtc_app_name'),
setupIntentClientSecret: clientSecret,
})
if (error) {
setIsLoading(false)
return Alert.alert(error.code, error.message)
}
const {error: errorPaymentSheet} = await presentPaymentSheet()
if (errorPaymentSheet) {
return setIsLoading(false)
}
const _response = await confirmSetupIntent(setupIntentId, {
paymentMethodType: 'Card',
})
console.log(_response)

#

we get the error in confirmSetupIntent

undone pewter
#

@minor blade I'm strugglignt o see how confirmSetupIntent can raise that error when it seems to clearly log the success

#

Are you certain you aren't getting the error elsewhere?

#

lkb2k_reactnative-paymentsheet

#

I'd recommend maybe augmenting your logs a bit to more clearly say which part is returning what log

cold ridgeBOT
rancid osprey
#

First, the clientSecret is obtained from an API Call to pass it to the initPaymentSheet function, and everything works fine up to this point.
Then, presentPaymentSheet is called, and no errors occur.
The issue arises when confirmSetupIntent is called sending the setup intent id. Currently, the setupIntentId is obtained from an API call that returns it with the client secret and the stripe customer id
@undone pewter

undone pewter
#

@ionic arch is going to take over for me. I would still recommend doing what I said: add better logs to confirm exactly what part of your code responds with what. Right now it's unclear I would say

rancid osprey
#
  const processPaymentSetup = async (clientSecret: string, setupIntentId: string) => {
    console.log('Starting processPaymentSetup function')
    console.log(`clientSecret: ${clientSecret}, setupIntentId: ${setupIntentId}`)
    const {error: errorInitPaymentSheet} = await initPaymentSheet({
      merchantDisplayName: translate('cdtc_app_name'),
      setupIntentClientSecret: clientSecret,
    })
    if (errorInitPaymentSheet) {
      setIsLoading(false)
      console.error('Error initializing payment sheet', errorInitPaymentSheet)
      return Alert.alert(errorInitPaymentSheet.code, errorInitPaymentSheet.message)
    }
    console.log('Payment sheet initialized successfully')
    const {error: errorPaymentSheet} = await presentPaymentSheet()
    if (errorPaymentSheet) {
      console.error('Error presenting payment sheet', errorPaymentSheet)
      setIsLoading(false)
      return
    }
    console.log('Payment sheet presented successfully')
    const {error: errorConfirmSetupIntent} = await confirmSetupIntent(setupIntentId, {
      paymentMethodType: 'Card',
    })
    if (errorConfirmSetupIntent) {
      console.error('Error confirming setup intent', errorConfirmSetupIntent)
    } else {
      console.log('Setup intent confirmed successfully')
    }
    setIsLoading(false)
    console.log('Finished processPaymentSetup function')
  }

The error happens at errorConfirmSetupIntent
log:

Error confirming setup intent {"code": "Failed", "declineCode": null, "localizedMessage": "Card details not complete", "message": "Card details not complete", "stripeErrorCode": null, "type": null}

@ionic arch

ionic arch
#

Looking into it now

cold ridgeBOT
rancid osprey
ionic arch