I got Stripe \ PermissionException error with new stripe api keys - stripe-payments

Working with Stripe Connect and making :
\Stripe\Charge::create
I got error :
Stripe \ Exception \ PermissionException
The provided key 'sk_test_51*************************************************
********************************************AE7z' does not have access to account 'acct_NNNN'
(or that account does not exist). Application access may have been revoke
My code worked with different stripe account, but I need to set api keys of my client
After logtin into stripe with credentials of my client I just activated the the Stripe connect,
but looks like not all settings are set: https://prnt.sc/10vfict
Which steps have I to take next ?
I wrote to support under my client credentials, but my client not
alwaysa available and as I have no acccess to his email account I ask if there is a
way to read messages from support in stripe dashboard? I did not find such possibility...
Thanks!

Related

Get Stripe Connected AccountsID Using Client Address Email

Using Stripe API, I built a Marketplace App. When the clients add their account to my stripe connect, I'm trying to get the client AccountID so I can do payout processing.
For the moment, I'm using Stripe's object (List all connected accounts). It returns a JSON object but I don't know how to get the client AccountID using client email address.
If anyone can help me to do this using cURL or PHP or java ...
There is no way to fetch or list Stripe Accounts by email address using the Stripe API.
The best approach would be to store an account ID to email address mapping on your end so you can find the account ID without listing all accounts using the Stripe API.

I have an issue with using stripe API for send payments to my customers bank account

I want to send payments to my customers bank account using stripe API.
I have used createExternalAccount API. Please help me out from this situation.
Error I got below:
The provided key 'sk_live_oj**********************' does not have the
required permissions for this endpoint on account 'acct_************'.
Having more permissions would allow this request to continue.

Why Can't I See My Connected Accounts in my Stripe Connect Section

So I have created a link for my partners to connect their accounts to my Stripe. This will allow me to do payouts, as I am doing an automation service, and my mission is to:
Take payments on behalf of my partners
keep a processing fee
Send the remainder to the partners acccount
I cant seem to see any of the people I am using as a test to sign up as connected accounts. They have went to the url, filled out the info, but they wont pop up in my account?
I believe my issue is the last step of authentication, where Stripe says in Stripe Express Docs section "The last step is to use the provided authorization code to make a POST request to Stripe’s token endpoint to complete the connection and fetch the user’s account ID:"
How do I implement this so i can proceed with my system? and if i need to code this into something how is this supposed to get accomplished? I just need the accounts to be connected into my account.
When the user has finished signing up, they get redirected to a URL you provide in redirect_url. In that URL's parameters is the authorization code:
https://yoursite.com/path/to/connect/flow?code={CODE_GOES_HERE}
To complete the flow, you then need to make a request to the Stripe oauth end point to confirm the user. Make sure that this request is made server side as the response you get contains sensitive information for your new connected account. The docs show a curl request but you could do this with any request API you have at your disposal:
curl https://connect.stripe.com/oauth/token \
-d client_secret=sk_123 \
-d code="{AUTHORIZATION_CODE}" \
-d grant_type=authorization_code
Where the AUTHORIZATION_CODE is the code found in the URL your users got redirected to.
Once the request completes, you should get a response with the new connected account details, provided everything went well:
{
"access_token": "{ACCESS_TOKEN}",
"livemode": false,
"refresh_token": "{REFRESH_TOKEN}",
"token_type": "bearer",
"stripe_publishable_key": "{PUBLISHABLE_KEY}",
"stripe_user_id": "{ACCOUNT_ID}",
"scope": "express"
}
You should save the account unique values (e.g. access_token) in your own database so you can easily retrieve it later rather than fetch it from the Stripe API every time.
Just came across this answer after having a similar issue due to missing out the second step of the authorisation process. Incase anyone else is still having issues I thought I would share another tip:
You can also manually create a link for testing or incase of a low volume of new connections. This does not require making a request to the Stripe oauth end point so less coding - this option is in de stripe dashboard under Connected Accounts > Create
screenshot of 'create' option

Stripe: StripeInvalidRequestError Error: No such token: btok_1CQUtNI6UceP4uARenSx4Cjo

I've created a bank account token from Plaid and now I want to use that bank token with Stripe but I get this error No such token: btok_1CQUtNI6UceP4uARenSx4Cjo
I'm using Plaid sandbox environment and Stripe test keys
I'm following this (https://plaid.com/docs/link/stripe) and I've done till step 4. Plaid creates a btok for me but Stripe doesn't accept it.
The detailed Stripe response is in the image
Stripe Tokens can only be used by the api keys of the account that created them (otherwise trying to use them will return a resource_missing error). Double check in your Stripe dashboard that the public key you are using to create the bank account token, and the secret key you are creating this request with belong to the same account.
If you want details about which accounts the bank account token or request were made from, please don't hesitate to write into support#stripe.com.
The issue was that I had multiple Stripe accounts and was using the Stripe account keys which weren't linked to Plaid.
Posting as may be helpful to someone struggling with this error. Try following
Make sure your secret(backend) and publishable(frontend) keys belongs to same account.
Consider my case where I was passing connected account as stripe account more than once. (using source for payments and having same issue 'No such token: src_xxxxxx'.)
Thanks
In the stripe.js file update code with own publishable key
// Set your publishable key: remember to change this to your live publishable key in production
// See your keys here: https://dashboard.stripe.com/apikeys
var stripe = Stripe('StripeKey');
var elements = stripe.elements();

How to verify a Stripe Connect, Account Deactivated web-hook?

With all other web-hooks one can use an account's stripe access token to retrieve the event and then update based on the response of the API call, thus preventing possible spoofing. But with account deactivated, one is no longer able to use that account's stripe access token since the account is deactivated. Any other suggestions? Basic auth is a no-go since each account can see the webhook url.
Stripe returns an error when you attempt to retrieve that event but that error is specific to this situation. You'll get an authentication_error if you attempt to retrieve it while if your weren't connected before you'd get invalid_request_error.
You can see an example in Ruby in this connect app here

Resources