问题
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: OAuth key, the Stripe-Account header, or the destination parameter.
I am passing in the Stripe-Account
header.
Could you please point me into the right direction?
Here is my curl request:
curl https://api.stripe.com/v1/charges \
-u sk_test_<key>: \
-H "Stripe-Account: acct_<key>" \
-d amount=2000 -d currency=usd -d capture=true \
-d card=tok_<key> -d description="curl" -d application_fee=48
Here is the response I get:
{
"error": {
"type": "invalid_request_error",
"message": "Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).",
"param": "application_fee"
}
}
回答1:
To add my experience of this issue to the comments above – when you include an application fee in the request, Stripe expects that you will be charging a customer on behalf of a connected account. The application fee is the amount that should go to your platform account, as your fee for the service you provide.
Stripe throws this error if it believes that the account being paid is the platform account, and therefore it makes no sense to process a separate application fee to the same account. Ways this can happen include passing in your platform account number instead of a connected account number in the request, or a destination parameter that is set to null.
The solution is to double check the account you are making payment to is not your platform account, or not include the application fee if the charge is going to your platform. I would add a link to the relevant part of the documentation, but I'm not aware of this being covered anywhere.
来源:https://stackoverflow.com/questions/31909342/stripe-api-error-when-passing-application-fee