#meet_code

1 messages ยท Page 1 of 1 (latest)

magic idolBOT
#

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

solar basalt
#

on_behalf_of: 'test' is an invalid value..

on_behalf_of needs to be a valid connected account ID starting with acct_xxx

pseudo lily
#

still facing the same error !

solar basalt
#

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 ?

magic idolBOT
pseudo lily
#

yeah, right I am setting value to on_behalf_of: after I received the above-mentioned error.

echo sequoia
#

๐Ÿ‘‹ Stepping in for my teammate. Can you share your client side code that shows how your initializing Elements and creating the PaymentElement?

pseudo lily
#

yeah

echo sequoia
#

Oh, I see what you shared above/in your original post

#

payment_intent_data : {
on_behalf_of: 'test',
},

pseudo lily
#
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();
    });
echo sequoia
#

You're not including onBehalfOf in your options above

pseudo lily
#

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 ?

echo sequoia
pseudo lily
#

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.

echo sequoia
#

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

pseudo lily
#

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 ?

echo sequoia
#

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

pseudo lily
#

working!

echo sequoia
#

Great!