Catching Stripe errors with Try/Catch PHP method

后端 未结 6 883
独厮守ぢ
独厮守ぢ 2020-12-23 17:12

During my testing of STRIPE in a website, I built the code like this:

   try {
        $charge = Stripe_Charge::create(array(
          \"amount\" => $cli         


        
6条回答
  •  臣服心动
    2020-12-23 17:52

    I may be late to this question, but I ran into the same issue and found this.

    You just need to use "Stripe_Error" class.

    use Stripe_Error;
    

    After declaring that, I was able to catch errors successfully.

提交回复
热议问题