#shainanand
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- shainanand, 1 hour ago, 15 messages
sorry typed wrong here.
Undefined property: Stripe\\Service\\CoreServiceFactory::$accountSessions
this is the error message
Can you show me your code that triggers this error?
$stripe = new \Stripe\StripeClient([
// This is your test secret API key.
"api_key" => 'somekey',
]);
try {
$account_session = $stripe->accountSessions->create([
'account' => 'acct_1OMAaoQjqUxSKrw3',
'components' => [
'payments' => [
'enabled' => true,
'features' => [
'refund_management' => true,
'dispute_management' => true,
'capture_payments' => true,
],
],
],
]);
echo json_encode(array(
'client_secret' => $account_session->client_secret
));exit;
} catch (Exception $e) {
error_log("An error occurred when calling the Stripe API to create an account session: {$e->getMessage()}");
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
i just copied from the API doc
What version of our PHP library are you using?
8.1
Gotcha that is your issue
accountSession was added in 12.1.0: https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#1210---2023-08-31
So you'll need to upgrade
noted
thanks will try
When I updated the stripe, it is showing "stripe/stripe-php": "^7.128"
Is this the correct version?
No you need 12.1.0+ as I noted above
okay