如何仅使用客户ID在Stripe中创建付款对象?

时间:2018-08-31 07:59:37

标签: javascript php payment payout

请帮我解决一个问题。 我从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进行付款? 非常感谢!

0 个答案:

没有答案