#piotr_webhooks

1 messages ยท Page 1 of 1 (latest)

scenic voidBOT
#

๐Ÿ‘‹ 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/1483571829825212520

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

tender needle
#

Hi there,
to clarify, when you try to create a stripe transfer.created event using the cli, you get an error, that you need to provide a return_url ?

celest fulcrum
#

Yes

#

It infers i'm trying to create a payment_intent

#

It retuns this error message

Setting up fixture for: payment_intent
Running fixture for: payment_intent
Trigger failed: Request failed, status=400, body={
"error": {
"message": "This PaymentIntent is configured to accept payment methods enabled in your Dashboard. Because some of these payment methods might redirect your customer off of your page, you must provide a return_url. If you don't want to accept redirect-based payment methods, set automatic_payment_methods[enabled] to true and automatic_payment_methods[allow_redirects] to never when creating Setup Intents and Payment Intents.",
"request_log_url": "https://dashboard.stripe.com/acct_1SR4dcAuaI5FQVhC/test/workbench/logs?object=req_pwOqW0mc5lI8Ko",
"type": "invalid_request_error"
}
}

tender needle
#

Yes, a Transfer does indeed create an underlying Payment Intent

celest fulcrum
#

What I want to mock is an internal transfer of funds between my platform account and a connected account; I already have the code to create the Transfer, but I want to test the changes in state

tender needle
#

Let me test something real quick

#

If you have funds in the accounts balance, you can also simply skip the payment intent

celest fulcrum
#

how can I achieve that?

#

I tried
automatic_payment_methods[enabled]=true
automatic_payment_methods[allow_redirects=never

as the error message said but it doesnt work

tender needle
#

you can add --skip payment_intent do the CLI command

celest fulcrum
#

It gave me this error

Trigger failed: Request failed, status=400, body={
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such destination: 'acct_1TBXJgABWRmzDja0'",
"param": "destination",
"request_log_url": "https://dashboard.stripe.com/acct_1SR4dcAuaI5FQVhC/test/workbench/logs?object=req_LWFA4kH1uKfhVE",
"type": "invalid_request_error"
}
}

acct_1TBXJgABWRmzDja0 is a connected account in my sandbox, does the CLI require some config to point to the sandbox?

Review the list of error codes Stripe might return in an API response so you can handle responding to them in your integration.

tender needle
#

What is your sandbox ID?

celest fulcrum
#

you mean my platform account? acct_1Sowf3PTHpx8YQsL

tender needle
#

Your sandbox should have their own account ID

#

Let me just tell you what I see right now.

Ther request you shared, that failed, was made by platform acct_1SR4dcAuaI5FQVhC on connected account acct_1TBXJgABWRmzDja0

When I look up acct_1TBXJgABWRmzDja0, I can see that it is only connected to platform acct_1Sowf3PTHpx8YQsL

celest fulcrum
#

Mmm I checked acct_1SR4dcAuaI5FQVhC and thats the real acct, not sandbox, how can I tell the CLI to use the sandbox acct?

tender needle
#

you can use stripe login which should return a URL. When you copy and paste it into a browser, you can login to the right sandbox account in the dropdown

celest fulcrum
#

Thanks, totally missed changing to sandbox while loggin to CLI. I managed to create the event, however I'm getting an error in my code (java sdk) as I try to parse the event object to Transfer.

Class com.stripe.model.Account cannot be cast to class com.stripe.model.Transfer

I see this output on the CLI
Skipping fixture for: payment_intent
Setting up fixture for: account
Running fixture for: account
Setting up fixture for: transfer
Running fixture for: transfer

I should skip this too? In a real wrold scenario, when a Transfer is performed, will I have to deal with payment_intent and account when listening to webhooks?

tender needle
#

That

Skipping fixture for: payment_intent
Setting up fixture for: account
Running fixture for: account
Setting up fixture for: transfer
Running fixture for: transfer

seems normal to me. I have the same, when I tested this

#

What is the error you are facing? Those are just logs

#

Do you have a request ID or anything?

celest fulcrum
#

Yeah the CLI is working; I meant in my application code I expect a **Transfer **object from the webhook event, so I deserialize it and cast it to Transfer, however it fails saying that Account cannot be cast into Transfer

tender needle
#

Ok, can you try something like this instead

stripe trigger transfer.created \
  --skip payment_intent \
  --skip account \
  --override "transfer:destination=acct_YOUR_CONNECTED_ACCOUNT_ID" \
  --override "transfer:amount=100" \
  --override "transfer:currency=pen" \
  --override "transfer:metadata[transactionId]=3"
celest fulcrum
#

Thanks, works like a charm

tender needle
#

sweet

celest fulcrum
#

I just wonder, in a real world scenario, when my app goes to prod, will I have to deal with the payment_intent and account creation like with the CLI? or I will just focus on capturing the transfer events?

tender needle
#

You would only need to focus on the transfer. Everything else should already be handled by Stripe

#

Because Payment Intent and Connected Account will already exist when you receive the transfer.created event. Stripe does that.

celest fulcrum
#

Cool, thanks a lot for your time โœŒ๏ธ ๐Ÿ˜บ