PaymentIntent fails when using a connect account and setting setup_future_usage
to off_session
PaymentIntent creation
\Stripe\Stripe::setApiKey("sk_test_xxxxxxxxxxxxxxxxxxxxxxxx");
$result = \Stripe\PaymentIntent::create(
array(
"amount"=>1000,
"currency"=>"gbp",
"payment_method_types"=>array('card'),
"application_fee_amount"=>100,
"setup_future_usage"=>"off_session"
),
array("stripe_account"=>"acct_xxxxxxxxxxxxxxx")
);
print_r($result);
This is the uncaught error response
Fatal error: Uncaught exception 'Stripe\Error\InvalidRequest' with message 'You cannot update `setup_future_usage` from off_session to on_session on a PaymentIntent when using a publishable key. When `setup_future_usage` is already set, you can only update the value from on_session to off_session.'
If I remove the stripe_account
and application_fee_amount
keys from the array I get a successful creation, meaning its something to do with connected accounts
Stripe\PaymentIntent Object ( [id] => pi_xxxxxxxxxxxxxxxxxx [object] => payment_intent...
The stripe docs simply say the same as the error above
So it worked the next day without any changes.
Possibly was a Stripe bug