#Rachel Bingham-py-payments

1 messages ยท Page 1 of 1 (latest)

dim sage
#

Good question. Checking in to that...

#

Is the end goal to list out payments with that prefix?

glass thorn
#

The end goal is to call Stripe::Charge.list and be sure that all charges including the py_xxx ones are there.

We are missing some charges and normally we have a service which checks this but I think it is missing the bank payments

dim sage
#

Do you have an example id if a py_xxx that is not showing up?

glass thorn
#

Yes. But should I reveal it here???

dim sage
#

Not sure if that call alone can list those payments but I am sure there will be some way to list it

#

Yep, safe to send the IDs here

glass thorn
#

here's the charge py_3K546MKoz4lNOAHN0M5XpeWA

I have a script to list all charges between two times using a loop and```
created: { gte: since.to_time.to_i, lte: till.to_time.to_i }

That charge was created in between those times but is not showing up. Listing all charges ids there only seem to be ch_xx ones```

dim sage
#

Thanks for the info, will look in to this in a minute

glass thorn
#

Thanks ๐Ÿ™‚

dim sage
#

Interesting. I am able to see a charge that I create the same way when I list charges like that. Have you confirmed that py_3K546MKoz4lNOAHN0M5XpeWA specifically does not show up when you list charges from that time?

glass thorn
#

Yes, I pulled a list of charges from a 3 hour period covering when it was created and it (and possible several more) were not lncluded. I can share my script if that helps?

dim sage
#

Yes please, unsure why it wouldn't be listed there

glass thorn
#

Basically this


last_charge_id = nil
all_charges = []

loop do
  stripe_charges = Stripe::Charge.list(limit: 100,
    starting_after: last_charge_id,
    created: { gte: since.to_time.to_i, lte: till.to_time.to_i })

  stripe_charges.each do |stripe_charge|
    all_charges << stripe_charge
  end

  break unless stripe_charges.has_more
  last_charge_id = stripe_charges.data.last.id
end
#

Also

since = Time.new(2021, 12, 10, 6, 30)
till = since + 3.hours
stripe_charge = Stripe::Charge.retrieve("py_3K546MKoz4lNOAHN0M5XpeWA") 

stripe_charge.created.in?(since.to_time.to_i..till.to_time.to_i) # true
#

Also there were defo some other charges with py_xx ids during that period which is how we came to be investigating this (we had a short outage during this time)

dim sage
#

Not immediately seeing why it wouldn't show up in that call, especially if retrieve works from the same account

glass thorn
#

Yeah it is weird but it seems they can't be listed that way

dim sage
#

That was created from a payment intent, do you see the payment intent pi_3K546MKoz4lNOAHN0ZnKJosy when you list your payment intents?

glass thorn
#

I have the payment intent and the stripe event in our system. I don't normally try listing them

dim sage
#

I'm just trying to see where else this is present or not present

#

Or how I might be able to recreate this. Like I said I was able to find a charge with a py_ id from the same payment method.

glass thorn
#

Oh, I'll try that autopaginator - haven't see that before.

#

Same result with autopaginator. I have a confession - we are on API version "2014-09-08" - could that be the issue?

dim sage
#

Yes, that may have something to do with it. Let me check in to that.

glass thorn
#

Thanks

dim sage
#

So yes, it looks like this is related to your API version. 2015-09-23 is the version that first allowed non-card payment types to be retrieved via the list all charges call. https://stripe.com/docs/upgrades#2015-09-23

#

Thinking for a bit on what you can do here...

glass thorn
#

We are looking to upgrade but it is not imminent. But we do need to be able to locate missing payments ๐Ÿ˜•

dim sage
#

Good to know. Unfortunately I am not seeing an easy way to modify that call to get non-card payments on your version

#

Which would allow it to list the payments you are looking for. I don't think the structure of the objects has changed so that may not be too large a lift in this specific case One thing that comes to mind is that you can override the API version for your app and make this list call https://stripe.com/docs/api/versioning?lang=ruby

glass thorn
#

Good idea. I will try that out. Thanks for your help.

#

That worked! Thank you so much. I have found 11 missing payments ๐Ÿ™‚