#meet_code
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/1275554053941760071
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
on_behalf_of: 'test' is an invalid value..
on_behalf_of needs to be a valid connected account ID starting with acct_xxx
still facing the same error !
Sorry let me clarify
Are you setting on_behalf_of: acct_1PMBYBC6TOnjhsJM on client-side as well as server-side? Can you share the code snippets for your API ?
yeah, right I am setting value to on_behalf_of: after I received the above-mentioned error.
๐ Stepping in for my teammate. Can you share your client side code that shows how your initializing Elements and creating the PaymentElement?
yeah
Oh, I see what you shared above/in your original post
payment_intent_data : {
on_behalf_of: 'test',
},
var stripe = Stripe('publishable_key');
const appearance = {
theme: 'stripe',
labels: 'floating',
variables: {
colorPrimary: '#0570de',
colorBackground: '#ffffff',
colorText: '#30313d',
colorDanger: '#df1b41',
fontFamily: 'Ideal Sans, system-ui, sans-serif',
fontSizeBase: '12px',
spacingUnit: '1px',
borderRadius: '4px',
}
};
const options = {
allow: 'payment *',
mode: 'payment',
amount: 1099,
currency: 'usd',
paymentMethodCreation: 'manual',
setup_future_usage: 'off_session',
appearance: appearance,
};
var elements;
// Function to initialize Stripe Elements
function initializeElements() {
console.log('elements were initialized. ');
if (!stripe) return;
elements = stripe.elements(options);
window.elements = elements;
window.stripe = stripe;
}
document.addEventListener('DOMContentLoaded', function() {
initializeElements();
});
You're not including onBehalfOf in your options above
If you intend to use on_behalf_of server side, you also need to use it client side when initializing Elements
how the param should included ? i do not see any initialization in the JS doc. What i meant was, should it be directly added on_behalf_of: 'acct_' or using a container object payment_intent_data ?
Client side, it should be under options: https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-onBehalfOf
Server side, it should be in the request body alongside params like amount: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-on_behalf_of
now I get this one: You cannot confirm with off_session=truewhensetup_future_usage is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage.,
...
but if i remove setup_future_usage: 'off_session' from the options,
....
I get The provided setup_future_usage (off_session) does not match the setup_future_usage from the provided confirmation_token (null). Try confirming with a Payment Intent that is configured to use the same parameters as the ConfirmationToken.
Okay, you're changing a few things and I think getting a little mixed up
on behalf of was passed correctly
I see the PI was created with both off_session: "true" and setup_future_usage: "off_session". If your goal is to save payment details for future use, omit off_session: "true" when creating the PI server side. Client side, you should pass setupFutureUsage: "off_session" in options
that means, to save the payment details, only clientside scripting is required (setup_future_usage:off_session ) and nothing should be done on server side !! ?
curiosity que, what off_session: "true" does on server side ?
No
If your goal is to save payment details for future use, create the PI server side with setup_future_usage: "off_session" and pass setupFutureUsage: "off_session" client side
working!
Great!