【问题标题】:retrieve the cardid of last card added to stripe customer检索添加到条带客户的最后一张卡的 cardid
【发布时间】:2014-05-30 23:51:25
【问题描述】:

我有以下代码用于为客户添加卡片,该代码运行良好并遵循条纹 API。但是,我需要检索我刚刚输入的卡ID。创建客户时我可以使用扩展方法,但不确定添加卡方法?

// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];

// Add a Card
$cu = Stripe_Customer::retrieve( $consumerCCID );
$cu->cards->create(array("card" => $token));

$defcard = $cu->card->id;
$last4 = $cu->card->last4;
$cardtype = $cu->card->type;
$expmonth = $cu->card->exp_month;
$expyear = $cu->card->exp_year;

【问题讨论】:

    标签: php stripe-payments


    【解决方案1】:

    Stripe 的库返回修改或创建的对象。如果你想要那个对象,就不要丢弃它:

    $new_card = $cu->cards->create(array("card" => $token));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-08
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      相关资源
      最近更新 更多