#raghul-s_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/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.
- raghul-s_docs, 2 hours ago, 14 messages
- raghul-s_docs, 6 days ago, 4 messages
Can you share the code you're using to initialise Payment Element?
We use deferred intent flow
Yep, I can see that hence why I'm asking for the code you use to initialise the Payment Element ๐
Sorry, that's a huge wall of code. I only need to see the StripeProvider/PaymentElement code and the props you pass it
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
}
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
})
}
What does paymentMethodTypesOrConfiguration look like for this specific invoice? I suspect whatever you're passing there doesn't have iDEAL included
We pass in Payment method configuration ID of LeadConnector's Default Payment method configuration
We enabled iDeal there. And, it's displaying.
OK, and what is that ID? pmc_xxx I suspect?
pmc_1M95aRFpU9DlKp7ReIqqY0PP
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
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?
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
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!
You can't as I've explained. Instead there will be a cloned PMC on the connected account(s) that is a child of the platform config settings that you can use, it's explained here: https://docs.stripe.com/connect/dynamic-payment-methods