【问题标题】:Stripe Charge::create geting error when I am including cutomer ID当我包含客户 ID 时,Stripe Charge::create 出现错误
【发布时间】:2015-12-15 19:06:39
【问题描述】:

以下代码出现错误

$charge = \Stripe\Charge::create( array(  'card'       => $myCard, 
                                              'amount'     => $post['job_cost']*100, 
                                              'currency'   => 'usd',
                                              'description'=> "Charge from ".$_SESSION['email'] . " (".$_SESSION['organization'].") for job " . $post['job_title'],
                                              'customer'   => "cus_7XOlaXPFww6URY"
                                            )
                                     );

如果我包含“客户”,那么错误是

An uncaught Exception was encountered

类型:Stripe\Error\InvalidRequest

消息:无效字符串:{"number"=>"424242******4242", "exp_month"=>"1", "exp_year"=>"2016", "cvc"=>"* **", "对象"=>"卡片"}

【问题讨论】:

  • 如果你传递一个客户ID,卡必须是一个字符串,代表已经添加到客户的卡的卡ID。

标签: stripe-payments


【解决方案1】:

您应该使用“客户”或“来源”属性,但不能同时使用。从当前的字符串create_charge PHP API 文档看来,'card' 不是一个有效的属性。

【讨论】:

    猜你喜欢
    • 2018-11-04
    • 2018-12-05
    • 2020-02-19
    • 1970-01-01
    • 1970-01-01
    • 2014-11-17
    • 1970-01-01
    • 2020-08-27
    • 2012-08-15
    相关资源
    最近更新 更多