#SuperFedz

1 messages ยท Page 1 of 1 (latest)

cedar hollowBOT
mystic breach
keen vessel
#

I've seen this but don't completely understand it and i'd love to see a written out working method.

mystic breach
#

What part of it are you having troubles with, did you try leveraging the pre-written snippet as a starting point?

keen vessel
#

I did haha. Just new to how pagination works thats all

mystic breach
#

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.

keen vessel
#

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

mystic breach
#

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.

keen vessel
#

Alright. I'll give it a go

#

Can you leave the thread open if i have further issues.

mystic breach
#

Sure thing!

keen vessel
#

More issues haha

keen vessel
#

Progress.

mystic breach
#

What have you tried to do to resolve those errors?

#

Ah, I was too late, sorry, glad to hear you're progressing.

keen vessel
#

no errors but need to make the method of how it actually creates a list of all the payment intents?

mystic breach
#

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?

keen vessel
#

Let me see now.

mystic breach
#

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.

keen vessel
#

Doesn't seem to be entering the loop. Paymentintent is not the correct variable inside the object

mystic breach
#

What does your Do something block look like now?

keen vessel
#

Debugged the loop and it does not enter

mystic breach
#

Hm, and if you put logging before the loop, do you see the output of that?

keen vessel
#

Yes.

mystic breach
#

If you look at your request logs in Stripe, are you seeing list requests being made?

#

Can you share your account ID?

keen vessel
#

Sure it is acct_1KdbdqEfUw2KXJVy

rigid ether
#

๐Ÿ‘‹ stepping in as toby needs to step away

keen vessel
#

Hi!

rigid ether
#

This is in testmode correct?

keen vessel
#

Yes correct

cunning vessel
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

keen vessel
#

Hey again tarzan haha!

cunning vessel
#

let's go back a bit a few steps back

keen vessel
#

sure sure.

cunning vessel
# keen vessel More issues haha

first couple of mistakes I noticed here:

  • your foreach loop should look like so await foreach (var paymentIntent in newService.ListAutoPagingAsync(options)) {}
keen vessel
#

Alright.

cunning vessel
#
  • 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())
  {
  }
}```
keen vessel
#

How would i pass a customer ID into this to return all PaymentIntents on file back?

cunning vessel
#

sorry about last message this is the correct code

keen vessel
#

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

cunning vessel
#
{
  var paymentIntentService = new PaymentIntentService();
  var listOptions = new PaymentIntentListOptions
  {
    Customer = customerId
  };
  await foreach (var paymentIntent in paymentIntentService.ListAutoPagingAsync(listOptions))
  {
  }
}```
keen vessel
#

Then from here. All of the payment intents iterate into what object?

rigid ether
#

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.

cunning vessel
#

sorry about this, I was pulled into something else my bad

cunning vessel
keen vessel
#

Awesome. I'll give it a test.

cunning vessel
#

let me know if you need any more help

keen vessel
#

I know i'm making a silly mistake, it doesn't exist in the context

cunning vessel
#

you need to put it inside the loop

keen vessel
#

Got it.

cunning vessel
#

inside the { } block

keen vessel
#

Nice. How would i append all of these into one singular array?

cunning vessel
#

do you really need to? what are you trying to achieve exactly?

keen vessel
#

I probably don't need to actually! Let me see what i can do haha.

cunning vessel
#

if you tell what are you trying to achieve I might be able to help

keen vessel
#

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

cunning vessel
#

In that case I wouldn't use auto pagination but instead would create a paginated table

keen vessel
#

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.

cunning vessel
#

something of that sort

keen vessel
#

Alright.

#

I'm going to need some help haha

#

Any resources or material would be greatly appreciated ๐Ÿ™‚

cunning vessel
#

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

keen vessel
#

That would be great. Thankyou

cunning vessel
#

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

keen vessel
#

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

cunning vessel
#

sorry what? I'm not following

#

what is StripeList?

keen vessel
#

Used to create StripeLists using payment intent.

#

Appends each payment intent inside it as a list of paymentintents.

cunning vessel
#

would you mind sharing your code snippet instead of sharing snapshots?

keen vessel
#

I have api keys defined inside rn haha. I think i've got it sorted though.

cunning vessel
#

ok I'm happy you're unblocked, I'm going to step away soon, do you need any more help before I leave?

keen vessel
#

I think i'm good now. I really appreciate the help!!

cunning vessel
#

no worries, would you mind me closing the thread then?