#steven_api

1 messages ยท Page 1 of 1 (latest)

mortal raftBOT
#

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

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

spice copper
#
import { loadConnectAndInitialize } from "@stripe/connect-js";

const fetchClientSecret = async () => {
  // Fetch the AccountSession client secret
  const response = await fetch('/account_session', { method: "POST" });
  if (!response.ok) {
    // Handle errors on the client side here
    const {error} = await response.json();
    console.log('An error occurred: ', error);
    document.querySelector('#container').setAttribute('hidden', '');
    document.querySelector('#error').removeAttribute('hidden');
    return undefined;
  } else {
    const {client_secret: clientSecret} = await response.json();
    document.querySelector('#container').removeAttribute('hidden');
    document.querySelector('#error').setAttribute('hidden', '');
    return clientSecret;
  }
}

const instance = loadConnectAndInitialize({
    // This is your test publishable API key.
    publishableKey: "pk_test_5xxxxxxxxxHF6VSG6",
    fetchClientSecret: fetchClientSecret,
    appearance: {
      overlays: 'dialog',
      variables: {
        colorPrimary: '#625afa',
      },
    },
});

const container = document.getElementById("container");
const paymentsComponent = instance.create("payments");
container.appendChild(paymentsComponent);


const installContainer = document.getElementById('app-install-container');
const appInstall = instance.create('app-install');
appInstall.setApp('com.chargeblast.cbalert'); // works fine up to here
appInstall.setOnAppInstallStateFetched(handleAppInstallFetched);
appInstall.setOnAppInstallStateChanged(handleAppInstallChanged);
installContainer.appendChild(appInstall);
deep dome
#

Thanks for the info, looking in to this. Can you link to the doc you are following here?

spice copper
#

is it possible the frontend needs a beta feature flag or version set (as the backend does) to use this .setApp function? This seems like the likely issue here.

#
import { loadConnectAndInitialize } from "@stripe/connect-js";

const instance = loadConnectAndInitialize({
    // This is your test publishable API key.
    publishableKey: "pk_test_******F6VSG6",
    fetchClientSecret: fetchClientSecret,
    appearance: {
      overlays: 'dialog',
      variables: {
        colorPrimary: '#625afa',
      },
    },
});

right now I load it like so

#

Whereas on the backend, in order to get the app embedded stuff to work I do:

const stripe = require("stripe")(
  // This is your test secret API key.
  'sk_test_51R******L7FAYbwl',
  {apiVersion: '2025-07-30.basil; embedded_connect_beta=v2;'}
);
deep dome
spice copper
#

ok

#

=18.5.0-beta.1 you believe?

#

that worked

#

ty

deep dome
#

Nice! Glad we could help

spice copper
#

could be useful to add that to the docs ๐Ÿ™‚

deep dome
#

Absolutely, will file that feedback