小编Gee*_* SJ的帖子

条纹Webhook响应

为什么我会像这样获得客户ID和发票ID cus_0000000000000和in_0000000000000?在条纹webhook响应中。我正在检查我的帐户中的事件和响应,我得到了200的响应,但是却获得了客户ID和发票ID,为什么?我正在检查发送测试webhook事件,我得到了这样的响应。

public function actionStripeHook() {


    if (Yii::app()->request->isPostRequest) {

        try {

            $postdata = file_get_contents("php://input");
            $event = json_decode($postdata);


                switch ($event->type) {

                    case 'invoice.payment_succeeded':

                        Yii::log('', 'trace', 'stripe');
                        Yii::log('==================================', 'trace', 'stripe');
                        Yii::log('==== Event (' . $event->type . ') ====', 'trace', 'stripe');
                        Yii::log('==================================', 'trace', 'stripe');
                        $customer_id = $event->data->object->customer;                            
                        $customer = Stripe_Customer::retrieve($customer_id);                            
                        $invoice = Stripe_Invoice::retrieve($event->data->object->id);
Run Code Online (Sandbox Code Playgroud)

}

我的代码有什么问题,这是我在条纹Webhook端点中的操作,我收到了事件类型invoice.payment_succeeeeeed该事件来自这种情况,但是在我的Response.s中无法正确获取客户ID和发票ID。为什么?

webhooks stripe-payments

0
推荐指数
1
解决办法
847
查看次数

标签 统计

stripe-payments ×1

webhooks ×1