#raghul-s_api

1 messages ยท Page 1 of 1 (latest)

old groveBOT
#

๐Ÿ‘‹ 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/1308740900289122345

๐Ÿ“ 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.

fickle nacelle
#

Can you share the code you're using to initialise Payment Element?

hushed sluice
#

We use deferred intent flow

fickle nacelle
#

Yep, I can see that hence why I'm asking for the code you use to initialise the Payment Element ๐Ÿ™‚

hushed sluice
fickle nacelle
#

Sorry, that's a huge wall of code. I only need to see the StripeProvider/PaymentElement code and the props you pass it

hushed sluice
#

We decide options here
function prepareStripePaymentElementOptions() {
const {
mode,
currency,
paymentMethodConfiguration,
paymentMethodOptions,
enableBNPL,
paymentMethodTypes,
} = props.stripeOptions

const paymentMethodTypesOrConfiguration = paymentMethodConfiguration
? { payment_method_configuration: paymentMethodConfiguration }
: { payment_method_types: paymentMethodTypes }
let { amount } = props.stripeOptions
let captureMethod = 'automatic'
if (
amount === 0 &&
mode !== StripePaymentMode.SETUP &&
mode !== StripePaymentMode.SUBSCRIPTION
) {
captureMethod = 'manual'
amount = 1
if (props.stripeMinimumChargeAmount)
amount = props.stripeMinimumChargeAmount[currency?.toUpperCase()] || 1
}
// https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment#additional-options
const options: any = {
mode,
amount: amountInSmallestCurrency(amount, currency),
currency: currency,
captureMethod,
...paymentMethodTypesOrConfiguration,
payment_method_options: paymentMethodOptions,
}

return options
}

Build an integration where you can render the Payment Element prior to creating a PaymentIntent or SetupIntent.

#

We mount the element here
async function createPaymentElement(options) {
const elements = stripeSDK.value.elements(options)
stripeSDKElements.value = elements
let terms = {
applePay: 'never',
auBecsDebit: 'never',
bancontact: 'never',
card: 'never',
cashapp: 'never',
googlePay: 'never',
ideal: 'never',
paypal: 'never',
sepaDebit: 'never',
sofort: 'never',
usBankAccount: 'never',
}
if (props.stripeOptions?.terms) {
terms = props.stripeOptions?.terms
}
stripeSDKPaymentElement.value = elements.create('payment', {
layout: props.stripeOptions?.layout,
terms,
})
if (!stripeSDKPaymentElement.value) {
setCardError(MESSAGES.STRIPE_PAYMENT_ELEMENT_CREATE_ERROR)
return
}
stripeSDKPaymentElement.value.mount(#${props.id})

stripeSDKPaymentElement.value.on('ready', function () {
emit(UI_PAYMENT_ELEMENT_CALLBACK.PAYMENT_CALLBACK, {
type: UI_PAYMENT_ELEMENT_EVENT.READY,
value: true,
provider: PAYMENT_PROVIDER.STRIPE,
})
})

stripeSDKPaymentElement.value.on('loaderror', function (event) {
console.log('Stripe Payment Element Load Error', event)
setCardError(MESSAGES.STRIPE_PAYMENT_ELEMENT_LOAD_ERROR)
})

stripeSDKPaymentElement.value.on('change', function (event) {
selectedPaymentMethod.value = event.value?.type
})
}

fickle nacelle
#

What does paymentMethodTypesOrConfiguration look like for this specific invoice? I suspect whatever you're passing there doesn't have iDEAL included

hushed sluice
#

We pass in Payment method configuration ID of LeadConnector's Default Payment method configuration

#

We enabled iDeal there. And, it's displaying.

fickle nacelle
#

OK, and what is that ID? pmc_xxx I suspect?

hushed sluice
#

pmc_1M95aRFpU9DlKp7ReIqqY0PP

fickle nacelle
#

Hmm, that won't work in this scenario as you're doing a direct charge. The pmc_xxx needs to belong to the connected account

hushed sluice
#

But we want our customer accounts to use the specific payment methods on the checkout.

Can you please explain why we shouldn't use Leadconnector's PMC ID?

fickle nacelle
#

Because you're doing direct charges so all related objects must exist on the connected account (acct_1Ihw53CScnf89tZo)

#

You can just omit the parameter when you create the Element and we'll use the default config for the account

hushed sluice
#

But we want to use LeadConnector's config's.

This is LeadConnector app where the connected accounts want to use LeadConnector's config based on our checkouts where we specify to use limited payment methods. We have been using this way from various checkouts from long back!

fickle nacelle