#brandontrytn_api

1 messages ¡ Page 1 of 1 (latest)

sudden pierBOT
#

👋 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/1219376752317562922

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

gilded juncoBOT
pliant ledge
#

elements = stripe.elements({
appearance: {
labels: 'above',
theme: userPrefs !== null && userPrefs.isDarkThemeEnabled ? 'night' : 'none'
},
clientSecret: clientSecret,
locale: window.globalSettings.culture
});

            paymentElement = elements.create('payment', {
                business: {
                    name: $('#ShopName').val()
                },
                defaultValues: {
                    billingDetails: {
                        address: {
                            country: settings.fields.$country.val()
                        },
                        name: settings.fields.$name.val()//,
                        //email: settings.fields.$email.val(),
                        //phone: settings.fields.$phone.val()
                    }
                },
                fields: {
                    billingDetails: {
                        address: {
                            country: 'never'
                        }
                    }
                },
                wallets: {
                    applePay: 'never',
                    googlePay: 'never'
                }
            });
            paymentElement.mount('#payment-element');
red vector
#

Just making sure I understand this, these are two different Stripe elements pages that you are creating payment intents for and confirming basically the same way?

pliant ledge
#

2 different pages yes, one we are fine supporting link on, the other we do not wish to present link option ever

#

the different sites are powered by the same api to create the payment intents

red vector
pliant ledge
#

is there a way to exclude a specific method but allow the others without having to specify all of them but the one?

red vector
#

Unfortunately not, as far as I am aware.

pliant ledge
#

currently we utilize automatic payment methods because we don't want to have to specify every payment method

red vector
#

This is an extension of automatic payment methods. It just lets you have multiple automatic payment method configurations.

pliant ledge
#

what api version is this available in? I do not see "available" link option in the list of paymentintentpaymentmethodoptions

            createOptions.PaymentMethodOptions = new PaymentIntentPaymentMethodOptions
            {
                Link = new PaymentIntentPaymentMethodOptionsLink
                {
                    Available = false
                }
            };
red vector
#

Which client library is that? I can check the changelog

pliant ledge
red vector
#

Ah, you are trying to set this on a completely different type of object. It looks like this field never existed on a payment method or payment intent's payment method options property
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_options-link-capture_method
https://docs.stripe.com/api/payment_methods/create#create_payment_method-link

#

The object that I linked to is a payment method configuration and you pass the configuration's ID to the payment intent when creating the intent

pliant ledge
#

is this configuration something made on the fly? so a call would be made to using this configuration object and the response contains an ID that would be used in the paymentintent create call? or is it created once and persisted?

red vector
#

Created once and persisted, these configurations are meant to be reused

pliant ledge
#

given we service connect accounts would this need to be created once for the platform, once per platform environment (live/test) or once per connected account?

sudden pierBOT
red vector
#

If you are using direct charges (payment intents created directly on each account), you would need configurations on each account. If the payment intents are created on your platform account, you only need to define this once on your platform account

pliant ledge
#

they are direct on each account, we only collect an application fee.

#

so seems like I would need a call to check for a configuration each time and name it such that I could filter down to this specific configuration (only in this instance) and if it does exist use it, if not create it on the fly for the account and then use it

red vector
#

Yep that makes sense to me. Depending on how many connected accounts you have it may make sense to just cache these PMC IDs on your side to avoid the lookup.
Also just to double check, each of your connected accounts will have this back vs front differenitation correct?

pliant ledge
#

yes, each one has both options

#

we could cache it, yes, that would be no problem at all for us

#

sometimes someone will pay with link on the front of office side and then the back of office side will edit the record which results in an additional charge. currently we support the additional charge using the saved link payment method on file which is stored on the stripe customer record. will this change impact that at all or will that continue to work?

red vector
#

That would be fine, you would just want to make sure link is an option for that second payment intent. So you would use whichever PMC has link available.

pliant ledge
#

and if we create a payment intent with no options config it will work as it does today?

red vector
#

I will test this right now to confirm how it works. Apologies

pliant ledge
#

oh great, that means I can create this once and just a constant in the code for the ID if that's the case

red vector
#

Yep, looks like you only need the one for your connect configuration on your platform account. Apologies that I was confidently wrong there at first.
The one caveat is that it is a bit weird to get the right ID to use. I had to get the ID from the connect settings page in the dashboard. Via the API you can list configurations while passing the Stripe-Account header for the connected account that you want to use. There will be a configuration with an application property that is your connect application's ID and then a parent_id property that is the pmc_ ID that you can use when creating a payment intent with the payment intents API. https://dashboard.stripe.com/settings/payment_methods/connected_accounts
If you list your configurations via the API, it lists the configuration with its ID on your parent account, which will error out if you pass it along with the Stripe-Account header for the connected account.

#

Basically, this configuration could have ID pmc_123 on your platform account, but the ID will be pmc_456 on your connected accounts. Listing the configs on your platform returns pmc_123 which will error out if you try to use it on a connected account. But if you list the configs on one of your connected accounts, it will give you the correct pmc_456 ID.
That was a lot of words, does that make sense?

pliant ledge
#

so I create the PMC once for the platform, then make the call at the connected account level to request the list of PMCs in order to get the ID as the ID will be unique to each connect account?

#

*ignoring the caching layer

red vector
#

The connected account ID wil actually be the same across your connected accounts. Our dashboard shows that ID, but for some reason our API doesn't return it for API calls from your platform at the moment. I will flag that we should add that to make things easier for direct charge situations.

pliant ledge
#

ok so if I use what's located in the dashboard after I create it I can use that pmc_ across all connected accounts?

red vector
#

Exactly

pliant ledge
#

ok sounds good, I like not having to make the calls every time, will create a new pmc to exclude link and pass that static id in my code for all new payment intents created using this back of office channel. will test that and if I run into unexpected results will revert back here

red vector
#

Yep sounds good to me. Glad we could find a solution here