如何在付款信息表中显示用户信用卡?

时间:2016-10-20 02:57:03

标签: php stripe-payments

我第一次使用PHP和Stripe API处理支付系统。

我有html表单,用户可以在其中添加信用卡信息。表格字段如下:

  1. 卡号
  2. CVC
  3. 我可以成功将用户信用卡添加到我的条带帐户作为客户帐户。

    现在添加了信用卡后,我可以使用条带API获取卡详细信息...

    • 是否需要在名为的表单字段中显示信用卡号 Card Number

    • 如果是这样,那么我看不到任何完整的信用卡号码,我可以看到其中一个 条带对象称为last4。我知道这是用户的最后4位数 信用卡

    • Okey,如果我只向Card Number字段显示4位数字,那么当我 更新表单显示The card number is not a valid credit card number.,因为该字段仅显示4 digit

    • 如果我再次将卡号输入Card Number字段,那么就是 已成功更新。

    现在如何更新用户信用卡而无需再次在Card Number字段中输入信用卡号?

    更新:

    这是付款信息表单图片: enter image description here

    和更新代码如下:

    $updateCustomer = \Stripe\Customer::retrieve("$acc_id");
    $updateCustomer->description = "Customer account of $fname_db $lname_db - #$u_id ($accountFor Account)";
    $updateCustomer->source = "$stripToken";
    $updateCustomer->save();        
    

1 个答案:

答案 0 :(得分:-1)

根据设计,Stripe的API不会返回完整的卡号。除非您自己获得PCI认证,否则您的服务器永远不能访问完整的卡号。

create a charge使用已保存的customer,您只需在customer参数中传递客户ID。

This tutorial解释了如何创建客户,然后使用客户创建费用。