#Mickadelyon

1 messages · Page 1 of 1 (latest)

open belfryBOT
lime vale
#

👋 happy to help

fossil swan
#

req_JkYRwoojTvzfXr

lime vale
#

you're passing an empty source object

#

but in all cases why do you need a source? and how are you creating it?

fossil swan
#

require_once('../vendor/autoload.php');

require_once('../secrets.php');

\Stripe\Stripe::setApiKey($stripeSecretKey);

$customer = \Stripe\Customer::create([
"email" => $_POST["email"],
"source" => $_POST['stripeToken']
]);

$subscription = \Stripe\Subscription::create([
"customer" => $customer->id,
"plan" => $_POST['plan']
]);

// Récupération des données du formulaire
$token = $_POST['stripeToken'];
$plan = $_POST['plan'];
$email = $_POST['email'];

// Création du client
$customer = \Stripe\Customer::create([
'email' => $email,
'source' => $token,
]);

// Souscription du client à un plan
$subscription = \Stripe\Subscription::create([
'customer' => $customer->id,
'items' => [['plan' => $plan]],
]);

lime vale
#

I'm not sure where did you get this from but this seems to be a very old integration

fossil swan
#

I wanted to do it with ChatGPT

lime vale
#

ChatGPT's data model includes data up to 2021 which is a bit old and doesn't take into consideration deprecations and changes

#

within the Stripe APi

fossil swan
#

I understand, but when I tried alone, I couldn't do it

lime vale
#

I sent you a guide that explains step by step how to achieve the integration either in low-code or with custom code