#xfechx

1 messages · Page 1 of 1 (latest)

pallid crystalBOT
indigo nacelle
#

👋 How can I help?

frank wren
#

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

indigo nacelle
frank wren
#

that is exactly what I cannot find

#

when I go to the logs, I cannot see it

indigo nacelle
#

It's likely that you use secret key belongs to account A and try to access charge object from account B

frank wren
#

but where can I see the logs

indigo nacelle
#

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?

frank wren
#

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

indigo nacelle
#

When did you perform this request?

frank wren
#

today

#

it is from a webhook

indigo nacelle
#

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

frank wren
#

but it is not a charge made on a connected account

#

it is a charge made on the platform account

indigo nacelle
#

It's not a charge on the platform

frank wren
#

which one is the connected account?

indigo nacelle
#

The connected account on this charge is acct_1MBuIeH19Ab5LLaZ

frank wren
#

i cant find it

#

so, it is a direct charge from the platform to a connected account?

dry parrot
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

frank wren
#

or is is a direct charge to the platform (through a connected app)

dry parrot
#

Essentially, this is a charge made on the Connected Account, using Platform's API keys.

frank wren
#

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?

dry parrot
#

Yes, you should see the Charge ID in the event payload.

frank wren
#

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...

dry parrot
# frank wren can the code, take the charge id, and using that, send a transfer using source t...

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.

frank wren
#

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

frank wren
#

i dont have it

#

I have the event id

#

evt_3NbDMTH19Ab5LLaZ1VkJP82B

dry parrot
#

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.
frank wren
#

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?

dry parrot
#

Could you maybe provide an example when this worked out successfully?

frank wren
#

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)

dry parrot
#

Ok, so in your setup there's 3 layers of Stripe accounts, Platform -> Platform -> Connected acct.

frank wren
#

yes

#

why did it work on that transfer, and not in the example originally shown to you?

dry parrot
#

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?

frank wren
#

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

dry parrot
frank wren
#

but how do i get the request id?
my steps will be to resend the webhook

dry parrot
frank wren
#

I alraedy resent it

#

and then how do i look for it on the logs

dry parrot
#

I don't see it on this account: acct_1MBuIeH19Ab5LLaZ, so it means you're using the wrong API keys.

frank wren
#

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?

dry parrot
frank wren
#

yes, exactly. I am confused on why I don't see the error on the logs

dry parrot
#

What API keys are you using in the app that's listening to those events? What account they belong to?

frank wren
#

to acct_1MBuIeH19Ab5LLaZ

dry parrot
#

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.

frank wren
#

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

dry parrot
#

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.

frank wren
#

charge id: ch_3NbDMTH19Ab5LLaZ1UETEib5

#

weird, it worked now

dry parrot
#

Oh, ok. Did you change anything from last time?

pallid crystalBOT
frank wren
#

Yes, I think I found my own error..

#

sorry