mpa*_*cia 3 laravel stripe-payments laravel-cashier
在 Stripe 文档 / Laravel 收银台上,它说它可以在创建发票后自动发送电子邮件。我尝试在 Stripe 的设置菜单上切换与此相关的设置,但在购买或订阅后我没有收到任何电子邮件。我还需要手动编码发送电子邮件吗?(我认为它应该在创建发票后自动发送)
根据Stripe docs,如果您希望 Stripe 自动发送收据,您必须在创建订阅时设置客户的电子邮件参数,并确保在Stripe 仪表板上启用成功付款的电子邮件客户选项
$user->newSubscription('default', 'monthly')
->create($paymentMethod, [
'email' => $user->email, // <= customer’s email
]);
Run Code Online (Sandbox Code Playgroud)
请注意:
使用您的测试 API 密钥创建的付款收据不会自动发送。相反,您可以使用仪表板查看或手动发送收据。
但是如果你想通过 Laravel 发送收据,你可以定义一个新的 webhook 事件处理程序并使用Stripe webhook:
在Stripe 仪表板上设置一个新端点以https://your-domain.com/stripe/webhooks
将 URI 列为VerifyCsrfToken中间件中的例外或列出web中间件组之外的路由:
protected $except = [
'stripe/*',
];
Run Code Online (Sandbox Code Playgroud)定义一个新的WebhookController并向handleInvoicePaymentSucceeded控制器添加一个方法来处理invoice.payment_succeededwebhook:
protected $except = [
'stripe/*',
];
Run Code Online (Sandbox Code Playgroud)在您的routes/web.php文件中定义到您的收银台控制器的路径。这将覆盖默认的运送路线:
Route::post('stripe/webhook', '\App\Http\Controllers\WebhookController@handleWebhook');
Run Code Online (Sandbox Code Playgroud)(可选)您可以手动设置 Stripe 的 webhook 签名以提高安全性。
请参阅Laravel 文档形成更多信息。
| 归档时间: |
|
| 查看次数: |
1998 次 |
| 最近记录: |