#cdubs44-retreive-external-account
1 messages ยท Page 1 of 1 (latest)
What is a request ID? Where can I find it?
This would walk you through on how to locate one ๐
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Thansk @nocturne saddle. Here it is req_syeNs0GrwRpjQf
any update @nocturne saddle?
Sorry juggling between a few threads
Give me a few
no worries. Thanks!
Apologies for the delay here
Appreciate your patience ๐
no worries!
are you able to list it if you use List all cards API endpoint?
https://stripe.com/docs/api/external_account_cards/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Nope. Here is what returns:
{
"cards": [
{
"account": null,
"accountId": "acct_1KopyhQsucnnMpCP"
}
]
}
Are you sure that card is set as an external account?
okay gotcha.
Can you share your sample code that's trying retrieving the object?
[HttpPost("retrieveStripeAccount")]
public async Task<IActionResult> retrieveStripeAccount(AspNetUsers ap){
var trainerDb = await _stripeCustRepository.GetByUserIdAsync(ap.Id);
var service = new AccountService();
var acct = service.Get(trainerDb.StripeId);
return Ok(new
{
Account = acct,
}
);
}
So I pass the user object, then I find the stripeId from the userId and use that
Or if you want the cards one:
[HttpPost("test")]
public async Task<IActionResult> sendTest(AspNetUsers ap){
var trainerDb = await _stripeCustRepository.GetByUserIdAsync(ap.Id);
var options = new ExternalAccountListOptions {
Limit = 3,
};
var service = new ExternalAccountService();
var cards = service.List(trainerDb.StripeId, options);
return Ok(new
{
cards = cards,
}
);
}
gotcha.
Let me take a look
I'm pretty sure i'm overlooking something simple here
Let me ask my colleagues
Thank you!
can you try using a CURL request to retrieve the account and check if you can see the external account there?
https://stripe.com/docs/api/accounts/retrieve?lang=curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'm not using CURL? I am using .NET?
Yes but can you try the curl request? This would help us confirm if the issue is with the code or the API
Yeah, looks like the CURL request worked
I had to change the sk_test key to the full key and type in my password, but it did work
Gotcha. so it is the code.
Not sure if we have any example code for this but you're likely looking at the wrong object.
StripeConfiguration.ApiKey = "KEY"
var service = new AccountService();
service.Get("acct_1KopyhQsucnnMpCP");
Thats whats in the docs for .NET and what I am using
I'll keep messing around and let you know if I find anything for future reference
Try this
var account = service.Get("acc ID");
Console.WriteLine(account.Id);
Console.WriteLine("Number of external accounts: " + account.ExternalAccounts.Data.Count);
var externalAccount = account.ExternalAccounts.Data[0];
if(externalAccount.Object == "card")
{
Card card = (Card) account.ExternalAccounts.Data[0];
Console.WriteLine("Card id: " + card.Id);
Console.WriteLine("Card last4: " + card.Last4);
}
else if(externalAccount.Object == "bank_account")
{
BankAccount bankAccount = (BankAccount) account.ExternalAccounts.Data[0];
Console.WriteLine("BankAccount id: " + bankAccount.Id);
Console.WriteLine("BankAccount last4: " + bankAccount.Last4);
}
else
{
Console.WriteLine("External account with unknown type: " + externalAccount.Object);
}```
Oh yeah that worked
Console:
acct_1KopyhQsucnnMpCP
Number of external accounts: 1
Card id: card_1KopzPQsucnnMpCP8HsgfGMh
Card last4: 5556
Perfect! ๐
You are the freaking man Hanzo!!
Happy to help ๐