#xfechx
1 messages · Page 1 of 1 (latest)
👋 How can I help?
Hi @indigo nacelle
so in my debugging, I can see this error:
There was a problem with your transaction<br>No such charge: 'ch_3NbDMTH19Ab5LLaZ1UETEib5'</strong></p>
it is an error on my webhook, for charge.succeeded
so all the operations are made with the charge, so not sure why at that point on the code it throws an error. It is while trying to make a transfer
Can you share the request ID (req_xxx) which you faced this error? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
It's likely that you use secret key belongs to account A and try to access charge object from account B
but where can I see the logs
You should be able to see the logs under the account of the secret key
Can you share the code on how you make the request?
well, it is a code that I have been using for a while now, and it doesn't have other problems
$transfer_object = \Stripe\Transfer::create(array(
'amount' => $transfer_to_app,
'currency' => $destination_currency,
'destination' => $app_stripe_id,
'source_transaction' => $charge->id,
'description' => get_bloginfo('name') . " Application Fees",
'metadata' => array("Description" => "Application Fee (" . $destination_currency . ' ' . number_format($transfer_to_app/100, 2) . ') from ' . $charge->description, "Application" => get_bloginfo('name'), "Link"=>get_bloginfo('url')),
));
echo '--- transfered to application: ' . $destination_currency . ' ' . $transfer_to_app/100 .' ---';
$transfer_subject = 'A transfer of ' . strtoupper($destination_currency) . ' ' . number_format($transfer_to_app/100, 2) .' has been sent to your stripe account.';
$transfer_message = 'You have received a transfer of '. strtoupper($destination_currency) . ' ' . number_format($transfer_to_app/100,2) .' from '. get_bloginfo('name') . ' Application fees';
wp_mail($admin_email, $transfer_subject, $transfer_message);
//updating transfer description on destination account:
$transfer_description = $transfer_object->description;
$destination_payment_id = $transfer_object->destination_payment;
$destination_charge_object = \Stripe\Charge::update(
$destination_payment_id,
[
'description' => get_bloginfo('name') . " Application Fees",
'metadata' => [
get_bloginfo('name') => $charge->description,
'Charge ID' => $charge->id
]
],
['stripe_account' => $destination]
);
}```
so I would like to see the event log for the transfer, I cannot find it anywhere
to see where the error is
When did you perform this request?
ch_3NbDMTH19Ab5LLaZ1UETEib5 is a Direct Charges on the connected account.
It shouldn't need any transfer as the payment is made directly on the connected account
If you use platform secret key to execute the code, then No such charge: 'ch_3NbDMTH19Ab5LLaZ1UETEib5' can be thrown since the object is on connected account instead of platform account
but it is not a charge made on a connected account
it is a charge made on the platform account
This is a Direct Charge on the connected account from this subscription: https://dashboard.stripe.com/logs/req_nlNoSL8OC4WEBS
It's not a charge on the platform
which one is the connected account?
The connected account on this charge is acct_1MBuIeH19Ab5LLaZ
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
or is is a direct charge to the platform (through a connected app)
Essentially, this is a charge made on the Connected Account, using Platform's API keys.
OK, so how do we access the charge id?
the webhook listens to charge.succeded
can the code, take the charge id, and using that, send a transfer using source transaction, to another account?
Yes, you should see the Charge ID in the event payload.
but i do see it
and when using it, I get the error
I want to see the actual log error from the transfer attempt
I get There was a problem with your transaction<br>No such charge: 'ch_3NbDMTH19Ab5LLaZ1UETEib5'
but the actual charge object is the one that the code is originally using
we are retrieving the charge.succeded event and the charge id comes there.
when using transfer, and using source_transaction as the charge id, we get the error of no such charge...
Because you are creating the Charge on the connected account, you will not be able to use it for transfer from the Platform to the Connected account (because it's already on the Connected account). And you don't need to.
Given you're using Standard accounts it's better to do Direct charges (what you're doing now). This doesn't require to do a Transfer. The funds will end up in the Connected account's balance.
that is not my use case.
we have attempted this before and done it many times. So I want to know why this time is not working.
Please do not suggest using direct charges, etc. We have already designed this for a while now.
We need to use this exact charge in 'Soma Mystica' and transfer to one of soma mystica connected accounts. Strictly using Transfers
we are talking about two different connected accounts.
So
when charge.succeded event arrives,
there is a webhook on this 'platform'
it calculates an amount, and sends part of the charge to a connected account to the 'platform',
The one who is doing the charge is an application connected to the platform. In your eyes it looks like the platform is a connected account.
not sure if I am explaining myself
so with the charge id, we should be able to make a transfer to a connected account
I want to know where I can find the error for the transfer log
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
I see this webhook event notification is send both to the account endpoint and to the connect endpoint. Where are you trying to create the transfer.
But in short, No such charge: 'ch_xxx' is a clear indicator that you are trying to use the charge from another account, which will not work. I assume you are trying to create a Transfer on the Platform with a Charge from the Connected account, and this is not possible.
You have to either
- Create the Charge on the Platform, and do the Transfer to the Connected account or
- Not create the Transfer, and just receive the funds on your Connected account.
please help me track the transfer event attempt
if there is a charge on the account, and we are listening it through the webhook. We should be able to use the charge id, and then transfer from source transaction to a connected account..
we have done it many many times
so I just want to know in this case, what is happening
hello?
I have explained earlier why it is not working, I don't know what else can I add.
Something must have changed in your application if it was working before. But in this case I can clearly see what's wrong, there's no mystery here.
Could you maybe provide an example when this worked out successfully?
sure
tr_3NAHhaAK8uIA2bZg2xpQb73C
I cannot see webhook older than 15 days, but that transfer was triggered from a subscription update charge (just like in this case)
we had the same formula, a connected account to the platform (which at the same time uses an app that does the direct charges to the platform)
Ok, so in your setup there's 3 layers of Stripe accounts, Platform -> Platform -> Connected acct.
yes
why did it work on that transfer, and not in the example originally shown to you?
I see that the account that owns the charge ch_3NbDMTH19Ab5LLaZ1UETEib5 has a different ID: acct_1MBuIeH19Ab5LLaZ, than the successful one. And also it's name is in CAPS.
Are you sure you're not mixing up the accounts?
yes, I am showing you an example of a working platform (it is a different account, but same setup)
the successful one, is the same business but different stripe account, but also the setup is : platform->platform->connected acct
Could you try this again and share the Request ID please? req_xxx
This would really help me investigate.
but how do i get the request id?
my steps will be to resend the webhook
You can resend the webhook and get the ID from your Logs: https://dashboard.stripe.com/test/logs
If it's in Live mode: https://dashboard.stripe.com/logs
I don't see it on this account: acct_1MBuIeH19Ab5LLaZ, so it means you're using the wrong API keys.
Ok, i took an example to show you another working example.
so, just go back to the original one I was discussing
which is
acct_1MBuIeH19Ab5LLaZ
to which account is going?
I don't need a working example, I understand how it works.
Let's try to find out why it doesn't work in this case. Because I feel like you are trying to create a Transfer on the wrong account, as I don't see the error log on acct_1MBuIeH19Ab5LLaZ.
yes, exactly. I am confused on why I don't see the error on the logs
What API keys are you using in the app that's listening to those events? What account they belong to?
to acct_1MBuIeH19Ab5LLaZ
Then we would see the error log. Can you please try to debug the code, maybe try to send a dummy request from that instance (e.g. list customers) and give me at least one object ID so I can verify what account it belongs to.
Alternatively, you can check if the API keys in the Dashboard correspond to the ones in your app.
yes, currently checking it all
ok, so in the webhook I retrieve the charge successfully and print the id that it corresponds.
So that means the API keys are correct
Maybe you're creating the Transfer on a different account.
That's why I'm asking for the request ID, you can print it as part of the error message.
Oh, ok. Did you change anything from last time?