0

请帮我解决一个问题。我从javascript(使用stripe.js)获得一个令牌并将其传递给我的php脚本以创建一个客户:

$customer = \Stripe\Customer::create(array(
                "description" => "Customer for blah-blah-blah",
                "source" => $post['token_id']
            ));

然后我使用创建的客户创建银行帐户:

$customer = \Stripe\Customer::retrieve($customer_id);
        $bank_account = $customer->sources->create(array(
            "bank_account" => array(
                "country" => "US",
                "currency" => "usd",
                "account_holder_name" => $post['account_name'],
                "account_holder_type" => 'individual',
                "routing_number" => $post['routing_number'],
                "account_number" => $post['account_number']
            )
        ));

现在我需要创建一个支付,但只使用客户 ID。我试过这样:

$payout = $customer->sources->create(array(
        "amount" => $amount,
        "currency" => $currency,
        'customer' => $customerId,
    ));

但这行不通。现在我通过 \Stripe\Charge 付款:

$payout = \Stripe\Charge::create(array(
        "amount" => $amount,
        "currency" => $currency,
        "customer" => $customer
    ));

请告诉我,有什么方法可以不使用 \Stripe\Charge 并仅使用客户 ID 进行付款?十分感谢 !

4

0 回答 0