#caderann_code

1 messages ¡ Page 1 of 1 (latest)

manic zephyrBOT
#

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

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

last lynx
#

additional code context:

public function createSetupIntent(CenterContact $centerContact): array
    {
        $ephemeralKey = Stripe\EphemeralKey::create([
            'customer' => $centerContact->gateway_id, //stripe customer id
        ],
            ['stripe_version' => '2023-10-16', 'stripe_account' => $this->stripe_id]
        ); // $this->stripe_id is connected account id
        $stripeIntent = StripeSetupIntent::create([
            'customer' => $centerContact->gateway_id, //stripe customer id
            'automatic_payment_methods' => [
                'enabled' => true,
                'allow_redirects' => 'always'
            ],

        ], ['stripe_account' => $this->stripe_id]); // $this->stripe_id is connected account id

        return [
            'setup_intent' => $stripeIntent,
            'ephemeral_key' => $ephemeralKey->secret
        ];
    }
marble trout
#

Hi! Is the setup intent being created on the same account as the publishable key is being used?

last lynx
#

yes, we've verified it

#

the Publishable key is of the account of the parent stripe account, not the connected account

#

we're also getting this error in the app network logs:

{
  "error": {
    "code": "resource_missing",
    "doc_url": "https://stripe.com/docs/error-codes/resource-missing",
    "message": "No such setupintent: 'seti_1S2SCGAXSZpEHfLwgIdKQroq'",
    "param": "intent",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_ZTOI3ho9nfkk2A?t=1756711837",
    "type": "invalid_request_error"
  }
}
marble trout
#

You are using the Stripe-account header to create the Setup Intent. This means the Setup Intent lives in the connected account. So you will have to use the publishable key of the connected account and not the platform.

last lynx
#

okay, can we retrieve the publishable_key for the connected using API?

#

because we cannot hardcode the publishable key in our app as it's white-labelled

marble trout
#

Just checking on above.

last lynx
#

we're already sending it in the request header as given in the above code snippet

marble trout
#

Above is your backend code correct?

last lynx
#

yes

marble trout
#

The error is for the frontend as it mentions the publishable key. The document I linked is for the frontend as well.