0
我在Laravel 5.1,條紋API 2015年10月16日Laravel 5.1出納網絡掛接,handleCustomerSubscriptionDeleted
我試圖處理:customer.subscription.deleted所以我重寫handleCustomerSubscriptionDeleted 但方法不會被調用..(即使我返回而不的代碼其他線路200響應條紋日誌500錯誤響應)
我如文檔中所述的路由:
Route::post('/stripe/webhook', '[email protected]');
定製控制器:
namespace App\Http\Controllers;
use App\Abbonamento;
use Symfony\Component\HttpFoundation\Response;
use Laravel\Cashier\WebhookController as BaseController;
class WebhookController extends BaseController
{
/**
* Handle a stripe webhook.
*
* @param array $payload
* @return Response
*/
public function handleInvoicePaymentSucceeded($payload)
{
$subscription = $payload['data']['object']['subscription'];
$abbo = Abbonamento::bySubscription($subscription)->first();
if ($abbo)
{
$abbo->makeStripePayment($payload);
}
}
public function handleCustomerSubscriptionDeleted($payload)
{
$subscription = $payload['data']['object']['id'];
$abbo = Abbonamento::bySubscription($subscription)->first();
if ($abbo and $abbo->subscribed())
{
$abbo->subscription()->cancel();
}
return new Response('Webhook Handled', 200);
}
}
有人可以電話我爲什麼「handleInvoicePaymentSucceeded」的作品,但「handleCustomerSubscriptionDeleted」從來沒有叫什麼名字?
的問題是不是我的自定義實體「Abbonamento」,只是說說爲何我總是看到錯誤500如在條紋測試ENV返回響應爲customer.subscription.deleted,並 invoice.payment_succeeded OK響應
感謝繪製ATTE ntion。 '5.4'具有受保護的函數handleCustomerSubscriptionDeleted(數組$有效載荷)' –