#Bart - connect requests

1 messages · Page 1 of 1 (latest)

rotund elmBOT
unreal cloak
#

The request is being made by this account acct_1M4wHMK5hOX6qDIa but the resource is owned by this account acct_1M9wXQGfEmwQN0CF

whole tiger
#

that sholdnt be happening tho

unreal cloak
#

That's the API request you made

#

Did you mean to pass the Stripe Account header in your request?

whole tiger
#
        DisplayName: stripe.String(Operating_Name),
        Address: &stripe.AddressParams{
            Line1:      stripe.String(line1),
            City:       stripe.String(city),
            State:      stripe.String(state),
            Country:    stripe.String(Country),
            PostalCode: stripe.String(postal),
        },
    }
    param.SetStripeAccount(Stripe_Account_ID)

    resultloc, err := location.New(param)
    if err != nil {
        return "", errors.New(err.Error())
    }```
#

yes i am

#

What about this location id: tml_E4S9Cg47VIV02T it should be connected to acct_1MA0vf2fCuSnvU8z

unreal cloak
#

Okay but that creates the location. When you tried to retrieve it you didn't provide a Stripe Account

#

Neither the account making the request nor the account that owns the location matches that ID

whole tiger
#

    l, _ := location.Get(
        "tml_E4S9Cg47VIV02T",
        nil,
    )
    fmt.Println(l)```
unreal cloak
#

That doesn't tell me anything as I don't know who that key belong to

whole tiger
#

stripe.Key belong to my account

#

im trying to get the location information from one of my connected accounts

unreal cloak
#

You can't

#

You need to make the request as that account

whole tiger
#

but what about creating the location ID

#

youre saying its making it for my account

#

when im trying to make it for the connected account id

#

tml_E4S9Cg47VIV02T

#

can you check what account ID owns that location id?

#

it should belong to acct_1MA0vf2fCuSnvU8z

unreal cloak
#

Okay yes that one is owned by that account

#

DO you still get an error when attempting to retrieve that one with your own API key?

whole tiger
#

but im not making one with my own API key for my self

#

im using my API key to create a location id For my connected account

unreal cloak
#

That won't work

#

Whatever account you create the location on needs to be the same account making the request to retrieve the location

whole tiger
#

wait what

#

im lost

#

im following this

#

im doing exactly this

unreal cloak
#

Do you have a request ID?

#

I'm confused because you have shared 1 request error response. It was specific to retrieving a location. I told you the request was made on a separate account from the account that owns the location.

whole tiger
#

solemme get this straight,

Master account -> Connected Account -> Connected Account Location ID

#

i can no retrive the connected account id information

unreal cloak
#

The location created with the code snippet you shared will be owned by the account specified as the Stripe Account. The request to retrieve that location. must also include that parameter

#

You need to make the retrieve request as the connect account

whole tiger
#

how would i do that

#

    l, _ := location.Get(
        "tml_E4S9Cg47VIV02T",
        nil,
    )
    l.SetStripeAccount("acct_1MA0vf2fCuSnvU8z")
    fmt.Println(l)```
#

this dosent work

unreal cloak
#

The same way you do with any Stripe request, set the account before you make the request

#

Bart - connect requests

whole tiger
#

thats what im doing look at the code

#

setstripeaccount

unreal cloak
#

After location.Get

#

Based on the result of your request that isn't working

whole tiger
#
func main() {

    stripe.Key = "sk_test_51M4mvOxcCi00Lzqy6IUs"

    params := &stripe.TerminalLocationParams{}
    params.SetStripeAccount("acct_1M4wHMK5hOX6qDIa")

    l, _ := location.Get(
        "tml_E4S9Cg47VIV02T",
        params,
    )
    fmt.Println(l)
}
#

i tried this too

unreal cloak
#

And you get the same result?

whole tiger
#

[ERROR] Request error from Stripe (status 404): {"code":"resource_missing","doc_url":"https://stripe.com/docs/error-codes/resource-missing","status":404,"message":"No such location: 'tml_E4S9Cg47VIV02T'","request_id":"req_gFQGpDalkvSUsF","request_log_url":"https://dashboard.stripe.com/test/logs/req_gFQGpDalkvSUsF?t=1669856768","type":"invalid_request_error"}

#

yes

#

and on the swift side of things

#

connectLocalMobileReader failed: Error Domain=com.stripe-terminal Code=9020 "No such location: 'tml_E4TACANHN0qbVN'" UserInfo={com.stripe-terminal:StripeAPIDocUrl=https://stripe.com/docs/error-codes/resource-missing, com.stripe-terminal:Message=No such location: 'tml_E4TACANHN0qbVN', com.stripe-terminal:HttpStatusCode=404, NSLocalizedDescription=No such location: 'tml_E4TACANHN0qbVN', com.stripe-terminal:StripeAPIRequestId=req_QV6ceCN3o9N77f, com.stripe-terminal:StripeAPIErrorType=invalid_request_error, com.stripe-terminal:StripeAPIErrorCode=resource_missing}

#

same error when attempting to use the location id and account id

languid plover
#

👋 taking over here

whole tiger
#

hey there

#

so here is the run down

#
in my backend im creating an account id from the input values my client uses, then i create their connected account which shows up on my dashboard on stripe for connected accounts, then i use that account_id i get back to create a location ID, then when i enter the account_id and location_id in the app i get the following error```
#

connectLocalMobileReader failed: Error Domain=com.stripe-terminal Code=9020 "No such location: 'tml_E4TACANHN0qbVN'" UserInfo={com.stripe-terminal:StripeAPIDocUrl=https://stripe.com/docs/error-codes/resource-missing, com.stripe-terminal:Message=No such location: 'tml_E4TACANHN0qbVN', com.stripe-terminal:HttpStatusCode=404, NSLocalizedDescription=No such location: 'tml_E4TACANHN0qbVN', com.stripe-terminal:StripeAPIRequestId=req_QV6ceCN3o9N77f, com.stripe-terminal:StripeAPIErrorType=invalid_request_error, com.stripe-terminal:StripeAPIErrorCode=resource_missing}

languid plover
whole tiger
#

acct_1MA0vf2fCuSnvU8z | tml_E4S9Cg47VIV02T do these belong to each other

languid plover
#
params.SetStripeAccount("acct_1M4wHMK5hOX6qDIa")

I think here you will need acct_1MA0vf2fCuSnvU8z instead

#

Yes acct_1MA0vf2fCuSnvU8z is a Connected Account, belongs to acct_1M4wHMK5hOX6qDIa which is a Platform Account

whole tiger
#

hmmm interesting

#
            Country:         stripe.String(Country),
            Email:           stripe.String(Email),
            Type:            stripe.String("express"),
            DefaultCurrency: stripe.String(Currency),
            BusinessType:    stripe.String(Business_Type),
            Settings: &stripe.AccountSettingsParams{
                Payments: &stripe.AccountSettingsPaymentsParams{
                    StatementDescriptor: stripe.String(Operating_Name),
                },
            },
            Individual: &stripe.PersonParams{
                FirstName: stripe.String(First_Name),
                LastName:  stripe.String(Last_Name),
                Phone:     stripe.String(Phone_Number),
            },
        }

        a, err := account.New(params)
        if err != nil {
            return "", errors.New("error creating stripe account - individual")
        }

        //Assigns the returned account id that was created
        Stripe_Account_ID = a.ID```
#

this i mycode for creating a connected account

#

then i create the location id

#
        DisplayName: stripe.String(Operating_Name),
        Address: &stripe.AddressParams{
            Line1:      stripe.String(line1),
            City:       stripe.String(city),
            State:      stripe.String(state),
            Country:    stripe.String(Country),
            PostalCode: stripe.String(postal),
        },
    }
    param.SetStripeAccount(Stripe_Account_ID)

    resultloc, err := location.New(param)
    if err != nil {
        return "", errors.New(err.Error())
    }


    Locations := fmt.Sprintf("%s", resultloc.ID)```
#

i create the location ID using the stripe account id of the connected account

#

so why is it not working?

languid plover
#

Right, that's great and expected. The location Id now belongs to the Connected Account

#

It's just the last step, when you want to get the location Id, you need to get in "on behalf of" the Connected Account. Because only Connected Account would understand it (only the Connected Account has a clue that it owns such a location object)

#

And you do that by specifying the Stripe Account header (SetStripeAccount) to the Connected Account Id (acct_1MA0vf2fCuSnvU8z)

whole tiger
#

wym i dont do that?

#

its right there in the code i sent you

languid plover
#

Yeah but what's the value of Stripe_Account_ID in the line param.SetStripeAccount(Stripe_Account_ID) ?

whole tiger
#

its the account id of when i created the connected account

languid plover
#

Yes, but looking at the log req_gFQGpDalkvSUsF, it seems still coming from your Platform account acct_1M4wHMK5hOX6qDIa (Taplyly)

whole tiger
#
    params.SetStripeAccount("acct_1MA1Z6Gfsbf0tXx9")

    l, _ := location.Get(
        "tml_E4TGlwtEgZwpYg",
        params,
    )
    fmt.Println(l)
}
#

this seems to work it gives me the connected account name

#

&{{0xc000326060} 0xc000326000 false Shadi Nach tml_E4TGlwtEgZwpYg false map[] terminal.location}

#

like its creating the account

#

and when i use the location id and the account id

#

it retrieves the data

#

like idk whats going on

#
    param := &stripe.TerminalLocationParams{
        DisplayName: stripe.String("1231231231231231"),
        Address: &stripe.AddressParams{
            Line1:      stripe.String("111 S Connie Cir"),
            City:       stripe.String("Anaheim"),
            State:      stripe.String("CA"),
            Country:    stripe.String("US"),
            PostalCode: stripe.String("92806"),
        },
    }
    param.SetStripeAccount("acct_1MA1Z6Gfsbf0tXx9")

    resultloc, err := location.New(param)
    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(resultloc.ID)
}
#

even when i try this

#

dosent work

#

?

languid plover
#

Hey, sorry will be back in a few mins

whole tiger
#

alright

#

no matter what i do it dosent work man

#
    params := &stripe.TerminalLocationParams{}
    params.SetStripeAccount("acct_1MA20vGasdZtfEll")

    l, _ := location.Get(
        "tml_E4TPjwJdpZJqX8",
        params,
    )
    fmt.Println(l)
}```
#

when i do this it WORKS

#

but when i do it in swift

#

i get this error

#

connectLocalMobileReader failed: Error Domain=com.stripe-terminal Code=9020 "No such location: 'tml_E4TPjwJdpZJqX8'" UserInfo={com.stripe-terminal:StripeAPIDocUrl=https://stripe.com/docs/error-codes/resource-missing, com.stripe-terminal:Message=No such location: 'tml_E4TPjwJdpZJqX8', com.stripe-terminal:HttpStatusCode=404, NSLocalizedDescription=No such location: 'tml_E4TPjwJdpZJqX8', com.stripe-terminal:StripeAPIRequestId=req_QV6ceCN3o9N77f, com.stripe-terminal:StripeAPIErrorType=invalid_request_error, com.stripe-terminal:StripeAPIErrorCode=resource_missing}

languid plover
#

So it works on backend, but not from Swift? How are you sending the request in Swift?

#

I think you just miss the part of setting the Stripe Account Header

whole tiger
#

so it works

languid plover
#

I am a bit confused. That's not Swift code

whole tiger
#

yes im saying the golang code

#

to retrieve the location ID information based on the connected account id works

#

but when i attempt to do the same in transaction in swift using account id and location id

#

it returns the error i sent

#

here is my swift code

#

it returns connectLocalMobileReader failed: Error Domain=com.stripe-terminal Code=9020 "No such location: 'tml_E4TPjwJdpZJqX8'" UserInfo={com.stripe-terminal:StripeAPIDocUrl=https://stripe.com/docs/error-codes/resource-missing, com.stripe-terminal:Message=No such location: 'tml_E4TPjwJdpZJqX8', com.stripe-terminal:HttpStatusCode=404, NSLocalizedDescription=No such location: 'tml_E4TPjwJdpZJqX8', com.stripe-terminal:StripeAPIRequestId=req_QV6ceCN3o9N77f, com.stripe-terminal:StripeAPIErrorType=invalid_request_error, com.stripe-terminal:StripeAPIErrorCode=resource_missing}

languid plover
#

So I think the onBehalfOf part is not how you specify the Connected Account

#

If it has been done correctly, it should appear on the ConnectedAccount requests log

whole tiger
#

how is it does correctly

#

i cant find docs on it

#

im following this exactly

#

thats how it should be

languid plover
#

Hey I am looking at it, there should be a way to passing in the stripeAccount into LocalMobileConnectionConfiguration...

whole tiger
#

yes but do you know the way ive been trying for the past 4 hours, the documentation is engrained in my head now

languid plover
whole tiger
#

yes i do exactly that

#

acct_1MA2EK2fdyCgG0bf

#

tml_E4TQkwuGwxzARZ

#

here is my code

#

see the exact same

languid plover
#

Yes, the issue is SetStripeAccount in Go lang, is correct, but the onBehalfOf in Swift, is not

whole tiger
#

what

#

ofc it is

#

im making the location in backeend

#

and im putting it in swift

#

but swift keeps throwing the errori sent you

languid plover
#

Yeah, because the location is made belongs to the Connected Account, and we need to find a way to make Swift to understand it

#

Gimme a few mins

whole tiger
#

sure thing, im doing what youre saying but its just not working

#

see this works like the account id works and stuff

languid plover
#

Yeah that's perfect (for the Go lang part)

whole tiger
#

yes the code works perfectly for golang, im able to check the location id based on conneccted accouunt id

#

but what about the swift code

languid plover
#

Did the ConnectionToken created in backend with the StripeAccount header?

whole tiger
#

        // In a new endpoint on your server, create a ConnectionToken and return the
        // `secret` to your app. The SDK needs the `secret` to connect to a reader.
        params := &stripe.TerminalConnectionTokenParams{}
        ct, err := connectiontoken.New(params)
        if err != nil {
            return ResponseReturn("unable to create connection token", 500), nil
        }
        Token := fmt.Sprintf("%s", ct.Secret)
        return ResponseReturn(Token, 200), nil```
#

yes

#

i did my connection token correctly

languid plover
#

Here, the token doesn't include the Stripe Account. We want to use the Stripe Account and point to the Connected Account

#

in the params, can you also do

params.SetStripeAccount("acct_xxx")
whole tiger
#

so i have to include that in connection token too?

languid plover
#

Yes, let's try it

whole tiger
#

alright i will in a bit thank you