【发布时间】:2014-08-03 22:23:34
【问题描述】:
我正在完成设置 Stripe 以在网站上上线,但是看到用户将要订阅,我想保护自己免受在订阅期间(即第一次付款后的任何时间)被拒绝的卡和通知他们。在 Stripe 网站上没有关于这个错误处理的深入讨论,所以我想知道当卡在订阅期间拒绝时是否会执行以下操作,因为我不知道有什么方法可以用 Stripe 进行测试.
try
{
// Try to charge the customers card here, subscription
}
//In the event of a card error
catch (Stripe_CardError $e)
{
// Card was declined.
$e_json = $e->getJsonBody();
$error = $e_json['error'];
print ($error['message']);
//Send the email to notify both parties that the payment declined.
$to = $_POST['email'];
$subject = 'Your card ending in'.['last4'].'has declined';
$message = 'Please remedy the situtaion at your earliest convience, there will be another attempt to charge your card in three days';
wordwrap($message, $width=75, "\n");
mail($to, $subject, $message);
}
我只是不确定这是否会发送,如果不是,我应该添加什么才能发送。非常感谢。
【问题讨论】:
标签: php stripe-payments subscription