#ashish846955
1 messages · Page 1 of 1 (latest)
hello! how can I help?
require_once('stripe-php-sdk/init.php');
use Stripe\Stripe;
use Stripe\AccountLink;
Stripe::setApiKey('Secret Key');
/* Create an Account Link */
$accountLink = AccountLink::create([
'account' => 'acct_1NIpF5Kt1T925T2i',
'type' => 'account_onboarding',
'refresh_url' => 'https://dashboard.stripe.com/',
'return_url' => 'https://dashboard.stripe.com/',
]);
echo 'Copy this link and connect your account: ' . $accountLink->url . '<br>';
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I have write the code on core php
this code is working fine for me
please redact the secret key. This is a public channel.
Okay
I have try to convert the wordpress code
require_once(PLUGIN_DIR_FUNDRAISER_PATH.'/Stripe/stripe-php/init.php');
try{
\Stripe\Stripe::setApiKey('Secret Key');
/* Create an Account Link */
$accountLink = \Stripe\AccountLink::create([
'account' => 'acct_1NIpF5Kt1T925T2i',
'type' => 'account_onboarding',
'refresh_url' => 'https://dashboard.stripe.com/',
'return_url' => 'https://dashboard.stripe.com/',
]);
$account_link_url = $accountLink->url;
echo 'Copy this link and connect your account: ' . $account_link_url;
}catch( Exception $e ){
echo "<pre>";
print_r($e);
echo "</pre>";
}
Here is my wordpress code
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
tripe\Exception\InvalidRequestException Object
(
[stripeParam:protected] =>
[error:protected] => Stripe\ErrorObject Object
(
[charge] =>
[code] =>
[decline_code] =>
[doc_url] =>
[message] => You requested an account link for an account that is not connected to your platform or does not exist.
[param] =>
[payment_intent] =>
[payment_method] =>
[setup_intent] =>
[source] =>
[type] => invalid_request_error
[request_log_url] => https://dashboard.stripe.com/test/logs/req_pwb3FsgGw0ogPe?t=1686807114
)
[httpBody:protected] => {
"error": {
"message": "You requested an account link for an account that is not connected to your platform or does not exist.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_pwb3FsgGw0ogPe?t=1686807114",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
showing this error
how can i resolve it!
because core php code is working fine
how did you create the account : acct_1NIpF5Kt1T925T2i?
If you're using Account Links, you should be creating an Account (https://stripe.com/docs/api/accounts/create) and then creating an Account Link for that newly created account
Account Links is not meant to be used for connecting an existing account.
I believe you asked the same question yesterday, and my colleague mentioned that you should be using OAuth : https://stripe.com/docs/connect/oauth-reference
If so, I want to connect the existing account, how can I do it?
Yes i have checked but this is not working
properly
could you please provide me php code only
so i will try
because i have lots of try
what specifically doesn't work? The page already shows an example of an OAuth link.
Yes but my user only enter stripe secret key
here is client id using
how can i get client id using secret key
you can get your client id on this page in your Dashboard : https://dashboard.stripe.com/test/settings/connect
Yes but how can i get using api?
The client id is only listed on your Dashboard. There's no Stripe API to retrieve the client id of your account if that's what you're asking.
OK