#matiullahpro-transfer
1 messages · Page 1 of 1 (latest)
Hi there! Can you clarify what you mean by transaction id here?
Do you mean you want the transfer ID itself?
Gotcha, so you want to set your request to a variable. Like:
$transfer = $stripepayout->transfers->create([...
Then after the request the id will be $transfer->id
but it not returning error... how can i achieve this?
That error means that your account you are trying to transfer to is not fully enabled to receive transfers.
You should see that error in your server logs when you attempt the transfer
Have you onboarded the Connected Account using the test Connect values? See: https://stripe.com/docs/connect/testing
but i want to access these errors response on my website...
Yeah you can catch the error server side and send it back to your client. See: https://stripe.com/docs/error-handling?lang=php
Can you add an error_log to your server and see if it is catching it there?
storing $api_raw_response in database...
@rich sedge I'm not sure I understand what you are saying
stripeLog.png shows you permission error... in Code.png i add permission exception but it doesn't returning error in $api_raw_response variable...
@rich sedge I'm sorry but this doesn't really make sense to me right now. what even is $api_raw_response where does that come from?
$api_raw_response is a variable where i am trying to store stripe server response..
kindly reply...
how can i get error response "code": "insufficient_capabilities_for_transfer",
@rich sedge I am trying to help but I don't understand your question
did you read https://stripe.com/docs/error-handling carefully? It covers in details how to handle errors in PHP
Did you see permission error in stripeLog.png
I want that response... How can i get that response on my website?
You catch the error in PHP and you log the relevant information
that's exactly what the doc I linked you to tells you to do
A user has not submitted his information... So he is not able to receive payments/transfer from anyone...
that's why I'm asking to read that doc carefully
Now when i try to make a transfer to his account... My code is recieving just empty object...
it feels like you are not reading my words
you're just saying many times it doesn't work
Can you please share your exact code for the Transfer creation? Not a picture, real code here in Discord
Ok
Ok
try {
$stripepayout = new \Stripe\StripeClient($stripe['secret_key']);
$transfers = $stripepayout->transfers->create([
'amount' => $val['amount']*100,
'currency' => 'usd',
'destination' => $val['account'],
]);
$api_raw_response=json_encode($transfers);
$status_msg='paid';
} catch(\Stripe\Exception\CardException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (\Stripe\Exception\RateLimitException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (\Stripe\Exception\RateLimitException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (\Stripe\Exception\ApiConnectionException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (\Stripe\Exception\PermissionException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (\Stripe\Exception\ApiErrorException $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
} catch (Exception $e) {
$api_raw_response=json_encode($e);
$status_msg='pending';
}
where does that json_encode come from? It's not on any of the PHP example on the entire page I gave you to look at first
which is why I keep asking if you can try and read that doc first
Ok .. that means i don't need to use json_encode for getting error and store into api_raw_response?
correct you don't
try {
echo "Trying to create a Payout<br>";
$stripepayout = new \Stripe\StripeClient($stripe['secret_key']);
$transfers = $stripepayout->transfers->create([
'amount' => $val['amount']*100,
'currency' => 'usd',
'destination' => $val['account'],
]);
echo "succeeded!<br>";
} catch(\Stripe\Exception\CardException $e) {
echo "an error occurred " .$e->getError()->message;
} catch (\Stripe\Exception\InvalidRequestException $e) {
error_log("An invalid request occuurred.");
echo "an error occurred " . $e->getError()->message;
} catch (Exception $e) {
echo "an error occurred that isn't Stripe";
var_dump($e);
}```
example try this ^
that will display the error message from $e->getError()->message and you can use $e->getError()->code to get the code
Ok Sir, it's really help me... That you Sir.