小编use*_*334的帖子

条纹,验证卡,仅在操作后充电

我正在为网站启用付款。我使用 Stripe 作为提供者。我想知道如果 2 个条件为真,我如何为卡充电。当用户付款时,我想更改数据库中的一个值,然后向卡收费。但是如果数据库查询失败,我不想对该卡收费。同样,我不想查询卡是否无效。我需要卡片有效和查询成功。我怎么做?

这是充值卡的代码

try {
$charge = \Stripe\Charge::create(array(
  "amount" => $amount, // amount in cents, again
  "currency" => "cad",
  "source" => $token,
  "description" => $description)
);
} catch(\Stripe\Error\Card $e) {
  // The card has been declined
}
Run Code Online (Sandbox Code Playgroud)

php payment paypal stripe-payments

5
推荐指数
2
解决办法
7208
查看次数

标签 统计

payment ×1

paypal ×1

php ×1

stripe-payments ×1