1

I'm trying to take charge from customer of connected account,

I have this error Cannot use stripe token more than once

This is my code:

$customer = \Stripe\Customer::create(array(
  "email" => $customer_email,
  "source" => $token,
),
array("stripe_account" => $stripe_connected_account)
);

$charge = \Stripe\Charge::create(array(
  "amount" => $the_fix_fee_convert,
  "currency" => "eur",
  "source" => $token,
  "description" => "Charge for subscription"
));

I tried to use customer instead source:

$charge = \Stripe\Charge::create(array(
  "amount" => $the_fix_fee_convert,
  "currency" => "eur",
  "customer" => $customer->id,
  "description" => "Charge for subscription"
));

But Stripe does not find the customer->id because its from $stripe_connected_account

I also tried this:

  $charge = \Stripe\Charge::create(array(
    "amount" => $the_fix_fee_convert,
    "currency" => "eur",
    "customer" => $customer->id,
    "description" => "Charge for subscription"
  ),
  array("stripe_account" => $stripe_connected_account)
  );

It works but charge is transfert on the connected account and not on the app account.

Any idea about this?

Rubyx
  • 708
  • 1
  • 11
  • 32
  • The error `Cannot use stripe token more than once` is showing up because you are using a single token to create a Charge and then to create a Customer. If you want to make a charge on the connected account, but get paid on the platform, you must set [an application fee](https://stripe.com/docs/connect/direct-charges#collecting-fees). Can you clarify what you mean by "It works but charge is transfert on the connected account and not on the app account."? – Henry Marshall Oct 03 '17 at 22:06
  • @henry I want to make a charge on the customer account for the platform and not for the connected account. – Rubyx Oct 03 '17 at 23:44
  • you can't charge the connected account's customers on the platform account. I'd spend some time reading the Connect documentation, especially https://stripe.com/docs/connect/authentication#stripe-account-header – Henry Marshall Oct 04 '17 at 21:01
  • do you want to charge same customer for connected account And App account both??? – Meera Tank Oct 06 '17 at 12:42
  • i think https://stripe.com/docs/connect/shared-customers will helps you – Meera Tank Oct 06 '17 at 12:43

0 Answers0