#SuperFedz
1 messages ยท Page 1 of 1 (latest)
The easiest approach is to use the auto-pagination functionality that was built into our library. You can read about it, and see a snippet for it, here:
https://stripe.com/docs/api/pagination/auto?lang=dotnet
I've seen this but don't completely understand it and i'd love to see a written out working method.
What part of it are you having troubles with, did you try leveraging the pre-written snippet as a starting point?
I did haha. Just new to how pagination works thats all
Our auto-pagination approach is a bit different than typical pagination, because it abstracts away the pagination aspect. You can iterate through a list and the library will automatically handle fetching new objects when you hit the end of the current set.
So i am making a call here with a limit of 100 but i need to retrieve all paymentintents >1000 so how do i then loop for the amount of payment intents in total
You would replace options with the name of your variable that is holding the list options, in this case newoptions, and then add the code that you want to run on each object where the Do something comment is.
Sure thing!
More issues haha
What have you tried to do to resolve those errors?
Ah, I was too late, sorry, glad to hear you're progressing.
no errors but need to make the method of how it actually creates a list of all the payment intents?
I'm not sure I fully understand the question, but I don't think you need to do that. If you do something simple right now like increment a counter in the Do something section, how many times does the line execute? More than 100?
Let me see now.
I don't think thinking of that object as a list is the best mindset, it's more like an iterator that can step through a list that you don't directly access but rather access solely through the iterator.
Doesn't seem to be entering the loop. Paymentintent is not the correct variable inside the object
What does your Do something block look like now?
Hm, and if you put logging before the loop, do you see the output of that?
Yes.
If you look at your request logs in Stripe, are you seeing list requests being made?
Can you share your account ID?
Sure it is acct_1KdbdqEfUw2KXJVy
๐ stepping in as toby needs to step away
Hi!
This is in testmode correct?
Yes correct
๐ taking over for my colleague. Let me catch up.
Hey again tarzan haha!
let's go back a bit a few steps back
sure sure.
first couple of mistakes I noticed here:
- your foreach loop should look like so
await foreach (var paymentIntent in newService.ListAutoPagingAsync(options)) {}
Alright.
- you should add the async keyword to your method definition and change the return type from T to Task<T>
e.g.
{
var paymentIntentService = new PaymentIntentService();
foreach (var paymentIntent in paymentIntentService.ListAutoPaging())
{
}
}```
How would i pass a customer ID into this to return all PaymentIntents on file back?
sorry about last message this is the correct code
Haha no bother. I'm fairly new to C# so just learning as i go. I originally had all this in Python but migrating across for a new project of mine
{
var paymentIntentService = new PaymentIntentService();
var listOptions = new PaymentIntentListOptions
{
Customer = customerId
};
await foreach (var paymentIntent in paymentIntentService.ListAutoPagingAsync(listOptions))
{
}
}```
Then from here. All of the payment intents iterate into what object?
Hmm looks like tarzan had to step away. Did you get this figured out SuperFedz?
I'm not very familiar with .NET but I can grab someone who is if you still have questions here.
sorry about this, I was pulled into something else my bad
the paymentIntent variable will be assigned the value of each iteration
Awesome. I'll give it a test.
let me know if you need any more help
you need to put it inside the loop
Got it.
inside the { } block
Nice. How would i append all of these into one singular array?
do you really need to? what are you trying to achieve exactly?
I probably don't need to actually! Let me see what i can do haha.
I am creating a html table of payment intents using asp net blazor.
I currently do this to create tables
I need to achieve the same with the payment intent
In that case I wouldn't use auto pagination but instead would create a paginated table
Okay! Can you explain this a little more?
I'm assuming paginating into an appended table as a pose to iterating through the paginated information.
something of that sort
Alright.
I'm going to need some help haha
Any resources or material would be greatly appreciated ๐
it's really out of the scope of what we normally support here, but I will try to get you some resources to get you started
That would be great. Thankyou
I can't seem to find a straight forward tutorial, it's either a component library or something like that
ok let's forget the table pagination for a minute, that could be done at a later stage
for now what you started with is not bad
you can create a new Array and construct the output objects inside the loop and append them to that array and return that to your View
I've just done that haha!
Only issue is i'mgetting "Object not set to a reference of an object" as my StripeList is not a parameter
Used to create StripeLists using payment intent.
Appends each payment intent inside it as a list of paymentintents.
would you mind sharing your code snippet instead of sharing snapshots?
I have api keys defined inside rn haha. I think i've got it sorted though.
ok I'm happy you're unblocked, I'm going to step away soon, do you need any more help before I leave?
I think i'm good now. I really appreciate the help!!
no worries, would you mind me closing the thread then?