尝试使用 php 设置 stripe api 并收到错误消息

因此,我按照 stripes 网站上的安装过程进行操作,目前收到一条错误消息,指出“未定义类型‘Stripe/StripeClient’”。


代码:


<?php

    require_once('vendor/autoload.php');

    $stripe = new \Stripe\StripeClient(

        ''

      );

      $stripe->customers->retrieve(

        'cus_HjS2guMajCRCG5',

        []

      );

?>


墨色风雨
浏览 120回答 1
1回答

慕哥9229398

所以我设法使用以下代码使其工作:<!DOCTYPE html><html>&nbsp; &nbsp; <head>&nbsp; &nbsp; <script&nbsp; src="https://code.jquery.com/jquery-3.5.1.min.js"&nbsp; integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="&nbsp; crossorigin="anonymous"></script>&nbsp; &nbsp; </head><body><?phprequire_once('vendor/autoload.php');$firstname = $_POST["inputFirstName"];$lastname = $_POST["inputLastName"];$email = $_POST["emailaddress"];$discordid = $_POST["discordid"];$stuff = array($firstname, $lastname, $email, $discordid);echo implode(" ",$stuff);$stripe = new \Stripe\StripeClient(&nbsp; &nbsp; 'HIDDENFORPRIVACYREASONS'&nbsp; );&nbsp; $stripe->customers->create([&nbsp; &nbsp; &nbsp; 'name' => $firstname . " " . $lastname,&nbsp; &nbsp; &nbsp; 'email' => $email,&nbsp;&nbsp; &nbsp; 'description' => $discordid,&nbsp; ]);?></body></html>&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP