#Sam Khachatryan

1 messages ยท Page 1 of 1 (latest)

spiral sirenBOT
subtle nest
#

Can you share more details? Which version of the SDK are you currently working with?

viscid silo
#

Nuget Stripe SDK 41.10.0 (Latest stable)

var service = new ExternalAccountService();
var bankAccountDetails = await service.GetAsync(stripeConnectUserId, bankAccount.Id)

bankAccountDetails.Last4 //Compile time error bcs no such property

subtle nest
#

Just to be clear, you're attempting to pull the last4 of a connected account's external bank account?

viscid silo
#

not only, but in this example yes))

subtle nest
viscid silo
#

just tried, but doesn't help

#

it returns IExternalAccount in any retrive scenario
`public interface IExternalAccount : IStripeEntity, IHasId, IHasObject
{
Account Account { get; }

    string AccountId { get; }
}`
#

I suppose there would be something like
string Last4 { get; }
which is missing

#

but for example exists in PaymentMethod retrive model inside sdk

#

P.S. copied IExternalAccount interface from stripe sdk code

calm warren
#

Hi there ๐Ÿ‘‹ taking over.

Give me a few minutes to get caught up.

#

So are you able to successfully send off the API request and get a response back then?

viscid silo
#

Yes api works well, for example I am fatching bank account id from external account service to make a payout to that acount

#

but I need to send last4 and bank name to client (frontend) to display there.
IExternalAccount doen't define that properties

#

but at the same time I am doing that with PaymentMethods (like attached cards)
Stripe SDK implemented last4, etc.. for that model

calm warren
#

Do you have a Request ID for the request that was successful? Just want to do some preliminary debugging first

#

I see you're using a specific version, but I'm curious if the example here looks similar to what you're using

viscid silo
calm warren
#

yeah, send over the Request ID and I'll dig some more

viscid silo
#

req_uu5xUFjUvYPF1D this is now using list api

#

also while debugging I can see that missing properties are included in Reponses (even formated with their C# model)
but interface from stripe sdk restricts me from reading

#

seems like Stripe SDK incapsulated that properties

calm warren
#

Hmmm, let me dig a bit more and get back to you in a few minutes

#

Out of curiosity what does the payload look like for you when you console log it?

viscid silo
#

all fields are existing, So As I got Stripe has the right model and it beeing casted in to their C#'s model in SDK like for example for payment method
stripe returnes StripeList<PaymentMethod>
For customer list stripe returns
StripeList<Customer>
Idk why only for external account service
Stripe returns
StripeList<IExternalAccount>
And I suppose ExternalAccount class exists just SDK incapsulates most part of properties using this interface, but model exists and beeing casted correctly

#

Hope this long message will help:D

spiral sirenBOT
calm warren
#

I'm confused though, you're specifically trying to access specific attributes of the object, can you not do that by iterating through the list of external accounts right now? Like, is the last4 attribute null?

viscid silo
#

in our domain when our connect account user passes verification form
we are showing them some details from his bank account.
Is there any way to achieve that by using this SDK
from backend side to send to client?

#

Like maybe manually parseing StripeResponse JSON and casting to to the type we need?

#

Btw thanks a lot for helping:)

calm warren
#

That's what I'm wondering too. Specifically, how do you know that the last4 is not present? You probably need recast the object in order to iterate through it, as it doesn't send back just a single object, it sends back multiple objects despite the fact that you set limit=1

viscid silo
#

let me attach an image

#

This case is with GetAsync but works the same

calm warren
#

Right, that's because IExternalAccount is an iterable. It's not one instance of an External Account object, so right now you're trying to access the attribute last4 on a list of objects, when what you need to do is first get the External Account object by itself and try to get last4.

Also, I don't think last4 is supposed to be capitalized

viscid silo
#

same situation here

#

but works well

#

why do I need differend approaches for them?)
sorry, can't really get

calm warren
#

That's an entirely different API with different return values.

If you look at the return values in the API reference, the Payment Methods API says it returns:

A Dictionary with a data property that contains an array of up to limit PaymentMethods of type type, starting after PaymentMethods starting_after. Each entry in the array is a separate PaymentMethod object. If no more PaymentMethods are available, the resulting array will be empty.
https://stripe.com/docs/api/payment_methods/list?lang=dotnet

But the External Account API returns:

Returns a list of the bank accounts stored on the account.
https://stripe.com/docs/api/external_account_bank_accounts/list?lang=dotnet

#

When you do Console.WriteLine(bankAccountDetails); , what do you see?

viscid silo
#

Sure

#

if (bankAccountDetails is BankAccount) { var c = bankAccountDetails as BankAccount; var last4 = c.Last4; }

#

I missed this part

#

thanks a lot))

#

It works fine now

calm warren
#

Huh, that's an interesting solution. Does it ever return last4?

viscid silo
#

haha:D no I sent it just as an example:DD

calm warren
#

So, wait... it's still not working then?

#

Or it is?

viscid silo
#

noo it works:DDD

#

thanks you very much

#

the thing is that I haven't cheched is it BankAccount and casted

#

so from IExternalAccount it becames BankAccount

#

and works well

calm warren
#

Ahhh, yup! I think that's the first thing I recommended, so glad I was able to help just a little bit ๐Ÿ˜…

viscid silo
#

just when you said that it's an iterable
I thought there is a misunderstanding
about StripeList<IExternalAccount> and IExternalAccount

#

I thought you mean that in general when I am getting a list not just one item, that list is iterable in C#

#

๐Ÿ˜ข ๐Ÿ˜ƒ

calm warren
#

Yeahhh, honestly having ambiguous terminology in my threads is half the reason solutions take so long ๐Ÿ˜“

#

Anyway, glad to hear it's working for you now. Let us know if you have any more questions!