代码之家  ›  专栏  ›  技术社区  ›  Cristian

如何一次收费多个项目在条纹?

  •  0
  • Cristian  · 技术社区  · 7 年前

    我正试图找到一种方法,让条纹一次收费多个项目。我想应该是这样的:

    $totalitems = [];
    if ( $item1 == "true" ) {
        $currentitem = array(
        "amount" => 19999,
        "currency" => "usd",
        "description" => "Item 1",
        "customer" => $customer->id,
        );
        array_push($totalitems, $currentitem);
    }
    
    if ( $item2 == "true" ) {
        $currentitem = array(
        "amount" => 29999,
        "currency" => "usd",
        "description" => "Item 2",
        "customer" => $customer->id,
        );
        array_push($totalitems, $currentitem);
    }
    
    $charge = \Stripe\Charge::create([$totalitems]);
    

    这只对数组中的第一项收费。有一种方法可以同时收取多个项目的费用吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   karllekko    7 年前