#allann_api

1 messages · Page 1 of 1 (latest)

next ploverBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1217542580691140669

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

thick grove
#

i want solve the issue in my account

#

when i put in CMD this code:

\Stripe\Stripe::setApiKey('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

echo \Stripe\Customer::retrieve('cus_Pj4SFclwL9dhiH');

it returns

C:\Users\allan\Desktop\tcc\ideiastcc\stripe>php index.php
Stripe\Customer JSON: {
"id": "cus_Pj4SFclwL9dhiH",
"object": "customer",
"address": null,
"balance": 0,
"created": 1710276769,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "exemplo@email.com",
"invoice_prefix": "DA70AF3F",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": [],
"name": "Nome do Cliente",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}

#

but i cant link using the coneect

#

because the issue in my account

gaunt scrollBOT
wanton sorrel
#

Hi, you shared a code snipped to GET a customer but the question asked in the form is related to Payouts, and the screenshot looks to be for restricted connected accounts. Can you add more clarity to exactly where you need help?

gaunt scrollBOT
thick grove
#

i need know

#

what happend to my account

#

i'm a student and i am learnig about stripe

#

and here the developer wrote the same code as me

lavish oriole
#

In order to restore your account’s ability to receive payouts, please check your email for next steps or reach out to our support team.
Hello, we can't help with account issues like whatever is blocking you from receiving payouts. That is a question for our support team https://support.stripe.com/?contact=true

thick grove
#

but he did say to write with my own id and codes like acct_ sk_242424¨¨&&&****

lavish oriole
#

If you have a question about a specific API request or error that you are seeing, I will need info on that specific request or error

thick grove
#

i belive my error is about my account

#

because

#

i use sk_test in my code, okay?

#

so it's from my profile ok?

#

to use connect accounts

#

i need the acct_424****** correct?

#

like here

#

and in my profile have 5 acct_ i can use some of them?

lavish oriole
#

What is the error that you are getting? Are you talking about those accounts being restricted? That is the default state until you collect the info that they need to get their requested capabilities enabled

thick grove
#

wait

#

i will print it

#

that's my request

#

correct?

#

when i go to CMD and write php inde.php it returns

}PHP Fatal error: Uncaught Stripe\Exception\UnexpectedValueException: Could not determine which URL to request: Stripe\Customer instance has invalid ID: in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiResource.php:107
Stack trace:
#0 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiResource.php(121): Stripe\ApiResource::resourceUrl()
#1 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiResource.php(57): Stripe\ApiResource->instanceUrl()
#2 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiOperations\Retrieve.php(26): Stripe\ApiResource->refresh()
#3 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\index.php(22): Stripe\Customer::retrieve()
#4 {main}
thrown in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiResource.php on line 107

lavish oriole
thick grove
lavish oriole
#

The error that you are getting seems to be a generic PHP error around how the call is being made

thick grove
#

so it's not to use the Connect?

#

but the accounts like cus_Pj4SFclwL9dhiH how can i set a "acct_1OtwLfPAA6eSZJb3" ?

lavish oriole
#

You should still use the account header

#

I was just linking because the API ref shows how to do this with the stripe client, which should sidestep the error that you are currently seeing

thick grove
#

but the code insides [] i need put my own?

#

like this

lavish oriole
#

Yes, that doc just has example values. You should provide real IDs from your account

thick grove
#

so it's the problem

#

i give my own values

#

but goes wrong

#

the problem in my account happen in de normal mode too

lavish oriole
#

What error are you getting now?

thick grove
#

i replace with my own information

lavish oriole
#

That error is saying that your $stripe variable is not defined.

#

So the issue is not the IDs that you are passing in. It sounds like you aren't initiating the $stripe variable before making this call

thick grove
#

ok

#

i correct it

#

but now shows another error

#

PHP Fatal error: Uncaught Error sending request to Stripe: (Status 403) (Request req_V0KiVsiYY3tJRd) This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys.
Stripe\Exception\PermissionException: This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys. in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php:38
Stack trace:
#0 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(227): Stripe\Exception\ApiErrorException::factory()
#1 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(180): Stripe\ApiRequestor::_specificAPIError()
#2 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(564): Stripe\ApiRequestor->handleErrorResponse()
#3 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(128): Stripe\ApiRequestor->_interpretResponse()
#4 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\BaseStripeClient.php(145): Stripe\ApiRequestor->request()
#5 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\AbstractService.php(75): Stripe\BaseStripeClient->request()
#6 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\ChargeService.php(89): Stripe\Service\AbstractService->request()
#7 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\authetication.php(64): Stripe\Service\ChargeService->retrieve()
#8 {main}
thrown in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php on line 38

#

and it say to use secret key

#

i replace the key

#

and this happen

#

PHP Fatal error: Uncaught Error sending request to Stripe: (Status 404) (Request req_X0KGW9x2IEOZY7) No such charge: 'cus_Pj4SFclw9dhiH'
Stripe\Exception\InvalidRequestException: No such charge: 'cus_Pj4SFclw9dhiH' in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php:38
Stack trace:
#0 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\InvalidRequestException.php(35): Stripe\Exception\ApiErrorException::factory()
#1 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(218): Stripe\Exception\InvalidRequestException::factory()
#2 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(180): Stripe\ApiRequestor::_specificAPIError()
#3 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(564): Stripe\ApiRequestor->handleErrorResponse()
#4 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(128): Stripe\ApiRequestor->_interpretResponse()
#5 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\BaseStripeClient.php(145): Stripe\ApiRequestor->request()
#6 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\AbstractService.php(75): Stripe\BaseStripeClient->request()
#7 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\ChargeService.php(89): Stripe\Service\AbstractService->request()
#8 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\authetication.php(64): Stripe\Service\ChargeService->retrieve()
#9 {main}
thrown in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php on line 38

lavish oriole
#

As the error says, you are making the charge retrieve call but are passing in a customer ID. To be clear, the connected accounts section of the API reference shows the charge call as an example but you can use the stripe account header for any of our API calls

thick grove
#

i need somthing like ch_3Lmjrl2eZvKYlo2C1bscjw8Z

#

but my account doesn't create payments lol

#

i belive it's because of this i don't have id like ch_3Lmjrl2eZvKYlo2C1bscjw8Z

lavish oriole
thick grove
#

so when the support solve my problem i can continue trying use the API?

lavish oriole
#

You can use it in test mode now, the payout restriction should only be in live mode

thick grove
#

really ?

#

so why doesn't generate a id payment

#

payments

#

and i can't configure my own connect wallet

#

and somethings like it

lavish oriole
#

What have you tried for those? In this thread we have only talked about retrieving customers and charges, so I don't know what you ran in to when trying to make payments

thick grove
#

all of above is about connect

#

and there in the 2nd class the developer talk about authentication i did all of them except the code i send to you

#

so if ican't do the authentication i can't continue

#

with de the paylisty

lavish oriole
#

Can you tell me what specifically you were trying to do with the authentication and how it failed?

#

On this server we don't have time to watch videos like that unfortunately, but we are happy to help if you provide more specific information on what you are trying to do

thick grove
#

oh sorry

#

ok

#

i will

#

wait a second

#

<?php
require_once 'vendor/autoload.php';

// <!-- static methods -->
// globally set API key

\Stripe\Stripe::setApiKey('pk_test_51OsUkmAB5JWK6wD3KcfHRNOVjOLDejmHHt6ZPaCV0iNonzclf4JHojHyM9VNaimWlskmYQ8Hib6jsasmXRFqmhW400acWVK5q0');

// echo \Stripe\Customer::all();

// per request
// \Stripe\Stripe::setApiKey('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

// echo \Stripe\Customer::retrieve('cus_Pj4SFclwL9dhiH',[
// 'api_key'=> 'sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l'
// ]);

// With connect
// \Stripe\Stripe::setApiKey('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

// echo \Stripe\Customer::retrieve(['cus_Pj4SFclwL9dhiH'], ['stripe_account' => 'acct_1OtwLfPAA6eSZJb3']);

// Client services
// Globally set API Key

// with connect
// \Stripe\Stripe::setApiKey('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');
// echo $stripe->customers->retrieve('cus_cus_Pj4SFclwL9dhiH', ['stripe_account' => 'acct_1OtwLfPAA6eSZJb3']);

// define a variavel $stripe como um novo objeto da classe StripeClient

// $stripe = new \Stripe\StripeClient('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

// cria um novo cliente
// $stripe = new \Stripe\StripeClient();

// $customer = \Stripe\Customer::retrieve('cus_Pj4SFclwL9dhiH');
// // retrieve é pra algum especifico

// $customer2 = \Stripe\Customer::all('');
// all é para todos os clientes

// echo $customer;

// echo $customer2;

// echo $stripe->customers->retrieve('cus_Pj4SFclwL9dhiH');

// echo $stripe->customers->retrieve(
// 'cus_Pj4SFclwL9dhiH',
// [],
// ['api_key' => 'sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l']
// );

#

that is my note of de class

#

some of them has correct and runned ok

lavish oriole
#

Sorry, to be clear I need to see the specific line of code that you are running that is getting this error.

#

One thing that immediately jumps out at me is that you don't need that linke that sets the pk_test key at all. For the server side API you should only be using your secret key.

thick grove
#

but when i will use 'stripe_account' => in some of them i have a error

lavish oriole
#

Also you should only need to set the secret key once if you are using the stripe clinet

#

Okay, let's focus on one error that you are getting. Can you try to make that call again but with the $stripe client and tell me what error you get?

thick grove
#

$stripe = new \Stripe\StripeClient('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');
$stripe->customers->all([],
['stripe_account' => 'acct_1OtwLfPAA6eSZJb3'] );

lavish oriole
#

Gotcha, and does that get an error?

thick grove
#

wait a second

#

i put that code

#

$stripe = new \Stripe\StripeClient('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');
$stripe->customers->retrieve('cus_Pj4SFclwL9dhiH',[],
['stripe_account' => 'acct_1OtwLfPAA6eSZJb3'] );

#

cus_Pj4SFclwL9dhiH it is from the web

#

acct_1OtwLfPAA6eSZJb3 from the connect in web

#

when i run C:\Users\allan\Desktop\tcc\ideiastcc\stripe>php authetication.php
PHP Fatal error: Uncaught Error sending request to Stripe: (Status 404) (Request req_s9BnPdw1Nxi2fr) No such customer: 'cus_Pj4SFclwL9dhiH'
Stripe\Exception\InvalidRequestException: No such customer: 'cus_Pj4SFclwL9dhiH' in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php:38
Stack trace:
#0 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\InvalidRequestException.php(35): Stripe\Exception\ApiErrorException::factory()
#1 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(218): Stripe\Exception\InvalidRequestException::factory()
#2 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(180): Stripe\ApiRequestor::_specificAPIError()
#3 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(564): Stripe\ApiRequestor->handleErrorResponse()
#4 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\ApiRequestor.php(128): Stripe\ApiRequestor->_interpretResponse()
#5 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\BaseStripeClient.php(145): Stripe\ApiRequestor->request()
#6 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\AbstractService.php(75): Stripe\BaseStripeClient->request()
#7 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Service\CustomerService.php(283): Stripe\Service\AbstractService->request()
#8 C:\Users\allan\Desktop\tcc\ideiastcc\stripe\authetication.php(60): Stripe\Service\CustomerService->retrieve()
#9 {main}
thrown in C:\Users\allan\Desktop\tcc\ideiastcc\stripe\vendor\stripe\stripe-php\lib\Exception\ApiErrorException.php on line 38

#

look like the code not looking in the web only in my machine where i have the customer cus_PjP5zXF7T5Aa20

lavish oriole
#

That cus_Pj4SFclwL9dhiH object exists on your platform account, not the connected account. So that call should succeed if you remove the account ID parameter

#

Or if you create a customer on that connected account and make this retrieve call on that ID

thick grove
#

\Stripe\Stripe::setApiKey('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

$stripe = new \Stripe\StripeClient('sk_test_51OsUkmAB5JWK6wD3f2b7VAOY4tflew1VxVbgLpdKFTOcEZ3SlQ79CSpLSoygEYCMIEigCZGBgqdzfQ5haxisvpPn00UUBTdp6l');

$customer = $stripe->customers->create([
'email' => 'customer@example.com',
], [
'stripe_account' => 'acct_1OtwLfPAA6eSZJb3'
]);

echo "Customer ID: " . $customer->id . "\n";
echo "Email: " . $customer->email . "\n";

#

C:\Users\allan\Desktop\tcc\ideiastcc\stripe>php authetication.php
Customer ID: cus_PjR7kZiYzBEkg5
Email: customer@example.com

lavish oriole
#

And does that error?

thick grove
#

I CREATE

#

{
"id": "cus_Pj4SFclwL9dhiH",
"object": "customer",
"address": null,
"balance": 0,
"created": 1710276769,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "exemplo@email.com",
"invoice_prefix": "DA70AF3F",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": [],
"name": "Nome do Cliente",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
],
"has_more": false,
"url": "/v1/customers"
}