提问人:Arash Rabiee 提问时间:11/17/2023 更新时间:11/17/2023 访问量:17
无法生成 stripe accountSessions
can't generate stripe accountSessions
问:
我使用的是 stripe Connect 子账户 基于 Stripe 的文档 我应该能够创建一个会话
$stripe = new \Stripe\StripeClient([
// This is a placeholder - it should be replaced with your secret API key.
// Sign in to see your own test API key embedded in code samples.
// Don’t submit any personally identifiable information in requests made with this key.
"api_key" => 'sk_test_VePHdqKTYQjKNInc7u56JBrQ',
]);
try {
$account_session = $stripe->accountSessions->create([
'account' => '{{CONNECTED_ACCOUNT_ID}}',
'components' => [
'account_onboarding' => [
'enabled' => true
],
],
]);
echo json_encode(array(
'client_secret' => $account_session->client_secret
));
} 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()]);
}
但是,我收到此错误:
"message": "Undefined property: Stripe\\Service\\CoreServiceFactory::$accountSessions",
看来$stripe->accountSessions不存在!在 Stripe 客户端对象中
答:
评论