I am trying to collect an application fee using the Stripe API. I am sure I am missing something in the request.
Stripe complaints that it needs either of these: OA
This happened to me when I accidentally had a nil
value for the recipient's stripe account number.
The solution was to make sure destination
was a valid stripe account code: e.g. "acct_1HtSHv7fgYVxT5fZ"
Stripe.api_key = 'sk_test_4eC39kjhkhgkhlhj1zdp7dc'
payment_intent = Stripe::PaymentIntent.create({
payment_method_types: ['card'],
amount: @amount_minor_unit,
currency: @currency,
application_fee_amount: 123,
transfer_data: {
destination: @stripe_account,
},
})
Stripe::InvalidRequestError (Can only apply an application_fee_amount when the
PaymentIntent is attempting a direct payment (using an OAuth key or Stripe-Account header)
or destination payment (using `transfer_data[destination]`).)
Once I had the correct value for @stripe_account
(instead of nil
), the above code worked