dongpinken0498 2017-04-04 23:51
浏览 44
已采纳

Slim 3&Stripe API兼容性问题

I started a web application using Slim 3. I went to add in the Stripe API and got a Slim Application error message. I removed the Stripe API code, and the error went away.

// Setup
\Stripe\Stripe::setApiKey('xx_test_XXXXxXxXXXXXxXxXXxXXXxXX');

// Get Token
$token = $_POST['stripeToken'];

// Charge the user's card:
$charge = \Stripe\Charge::create(array(
  "amount" => 1000,
  "currency" => "usd",
  "description" => "Example charge",
  "source" => $token,

));

I've Googled a few things, but still haven't found the source of the problem. I suspect that the \Stripe\ is the culprit, but I don't know why it is.

  • 写回答

1条回答 默认 最新

  • douhu7807 2017-04-05 10:12
    关注

    When you get a blank error page from Slim Framework you can find out the actual error in two ways:

    1. Check your PHP error_log as Slim will write the error there.
    2. Update your settings to set displayErrorDetails to true.
      i.e.

      $config = [
          'settings' => [
              'displayErrorDetails' => true, // set to false in production
              'addContentLengthHeader' => false, // Allow the web server to send the content-length header
      
          ],
      ];
      $app = new \Slim\App($config);
      

      The error message page will now display the details about what is actually wrong.

    Hopefully, you'll then be able to figure out what the problem is.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口