#Kromolabs Developer-setup intent

1 messages · Page 1 of 1 (latest)

sand pivot
#

Hi, are you using setup intent in the case of connected accounts?

split wasp
#

yes

#

that's one of the setup intent i'm testing seti_1KtSpaEWpJyoCJo9Pcbyf2Oj_secret_Lae7bIARiDqOVfGmE559jpZhUURwFB9

sand pivot
#

can you share your code please?

split wasp
#

yes

sand pivot
#

on the front end you're using the Stripe object which has the Stripe-Account header of the merchant right?

#

basically what I'm trying to say is that you created the Setup Intent using your Platform Account and you're trying to confirm it using the Connected Account

split wasp
#

trying

#

Serverside i think it's on Connected Account, otherwise it shouldn't recognise cus_, right?

#

Client side this is the stripe object

#

var stripe = Stripe("pk_test_51Hf0wyG1EiuzslYuJQo2F40g95vVzyRzO6phUaJJJbYRNJ2C53vBlFUy4OPtwoWdTTxTF3FZAUWrCJsT6AaKXswH00MLeSoTis", {
stripeAccount: "acct_1HSeQmEWpJyoCJo9"
});

sand pivot
#

on the backend you're not using this header

#

stripeAccount: "acct_1HSeQmEWpJyoCJo9"

#

so basically the SetupIntent is created on the Platform

split wasp
#

$stripe = new \Stripe\StripeClient(sk_test_51HSeQmEWpJyoCJo9qz8K7TioJUWZoJXUjB0WEGEYASKbumWPbT64hWFL6VekGRssG5pDAqjOHP6CyXAFe0CliLXe00EZ1TyNd5);

#

$setup_intent=$stripe->setupIntents->create([
'payment_method_types' => ['sepa_debit'],
'customer' => $_SESSION['loggato']['stripe_cus'],
]);

#

that's seti creation by backend

sand pivot
#

You created the SetupIntent using the Connect Account secret key, so this object belongs only to that Account which means when you're trying to confirm on the Front-End you're using both of the Platform Account and the Connect Account to authenticate the client_secret which means that there is going to be a mismatch

#

basically to fix that you need to instantiate your StripeClient on the backend the same way you did on the frontend with the secret key of the platform and passing the Stripe-Account header

split wasp
#

oh, understood

#

\Stripe\SetupIntent::create(
$object->payment_intent,
[
'payment_method_types' => ['sepa_debit'],
'customer' => $_SESSION['loggato']['stripe_cus'],
], array('stripe_account' => acct_1HSeQmEWpJyoCJo9)
);

#

Something like that, correct?

#

\Stripe\Stripe::setApiKey(); with platform Api key

sand pivot
#

so you can update the secret key here $stripe = new \Stripe\StripeClient(sk_test_xxxx); with the secret key of the platform

split wasp
#

Beautiful, thanks a lot!