#pedro-mameluque_api

1 messages ยท Page 1 of 1 (latest)

hoary iglooBOT
#

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

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

dreamy glen
torn gulch
#

Hey, sorry but the request doesn~t even show on my log! the checkout session doesn~t even open and I get error

dreamy glen
#

Can you share the exact text of the error you receive?

torn gulch
dreamy glen
#

Can you log the error on your server? Client-side errors don't provide enough information

#

Also can you share the code you are using to create the Checkout Session as text?

torn gulch
#

const session = await stripe.checkout.sessions.create(
{
payment_method_types: ["card", "pix"],
line_items: [
{
price_data: {
currency: "brl",
product_data: {
name: event.name,
description: event.description,
},
unit_amount: Math.round(totalAmountToCharge), // Apply discount
},
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: Math.round(totalAmountToCharge * 0.04), // aqui fica a taxa de servico
},
expires_at: Math.floor(Date.now() / 1000) + DURATIONS.TICKET_OFFER / 1000, // 30 minutes (Stripe minimum expiration time)
mode: "payment",
success_url: ${baseUrl}/tickets,
cancel_url: ${baseUrl}/event/${eventId},
metadata, // Include the metadata with coupon
},
{
stripeAccount: stripeConnectId,
}
);

dreamy glen
#

Ah okay so the reason you don't see the logs in your account is because you are making the request on a different account. Specifically the one identified by stripeAccount: stripeConnectId

#

Can you share that Account ID?

torn gulch
#

Hmm, I can replicate it with the other account, it~ll be easier I believe

#

give me 3min

#

thx for the help btw

dreamy glen
#

Why would you replace it?

#

It sounds like that account isn't properly configured and that is why you are seeing the error.

#

I can check that if you give me the ID

torn gulch
#

acct_1QuyDqQ11iMysMWU

#

would it be this ID?

dreamy glen
#

It would be whatever the value that you are passing in here is:

 {
      stripeAccount: stripeConnectId,
    }
#

Not acct_1QuyDqQ11iMysMWU. There are no requests on that account

torn gulch
#

oh, so I gave you the wrong one

#

1s

#

acct_1QuEhgQ3x4FhUeh5

dreamy glen
torn gulch
#

Hmmm

#

So I have to manually activate it in the settings

#

for each account that wants to accept it

dreamy glen
#

More likely you can set up your Connect Payment Method Configuration

torn gulch
#

I see that ~'on by default ' is greyd out so I believe it's supposed for each account to set it up, I can't activate it globally

dreamy glen
torn gulch
#

i tried the capabilities but I also get an error in the create when i add pix_ayments

dreamy glen
#

You can do this when you create the Account as well

#

Okay thats a Typescript error. What verion of the SDK are you using?

torn gulch
#

stripe@18.1.1

dreamy glen
torn gulch
#

Oh it makes sense!

dreamy glen
#

So yeah, if you upgrade to v18.2.0 you should see the pix_payments be a valid parameter for Account.capabilities

torn gulch
#

Ok thanks, I~ll just check how to update all existing accounts to this new capability

dreamy glen
#

Great ๐ŸŽ‰

torn gulch
#

Do you know a way for me to change all existing accounts to this new capability?

#

probably no easy way, right?

dreamy glen
#

You can use the Account Update API request to request the capability

torn gulch
#

Ok thanks I~ll look into it

dreamy glen
#

I code in Python mostly so I would do something like:


accounts = stripe.Account.list(limit=100)

for account in accounts:
    if "pix_payments" not in account.capabilities.keys():
        stripe.Account.modify(
          capbilities = {
              "pix_payment": { "requested": True}
          }
#

So I

  • get all my connected accounts
  • Check to see if they don't already have pix_payments
  • If they don't, request it
torn gulch
#

Great, ok, I get where it goes! thanks for sharing!

dreamy glen
#

Happy to help! Sometimes it's easier to see it in code

torn gulch
#

Thank you it worked ! I tested and I could finish a payment using PIX

dreamy glen
#

Great ๐ŸŽ‰ I'm glad it all worked out ๐Ÿ™‚

torn gulch
#

pi_3RjQBXQ3x4FhUeh503IqmIPv

#

but the issue now it just that I didn't got a webhook response when it succeeded

#

i have this webhook set and it was supposed to listen to the pix payment
we_1RTLLzLOgtMDtnWQ2Wm0r4B6

#

I thought the payment_intent.succeeded should have listenned to it..

dreamy glen
#

That is your Account webhook endpoint. It will only get events that occur on your account.

#

But because you are creating the Checkout Sessions on the Connected Account, the events only occur on the Connected Account

#

You have a Connect Webhook but it's only for Test mode and it is not listening for payment_intent.succeeded

torn gulch
#

Thanks, that was actually my bad! haha,

#

worked!