#KarlS-dotnet-paymentintent
1 messages ยท Page 1 of 1 (latest)
@marble pivot hard to say unfortunately without concrete examples. Can you share your dotnet code? Also did you see that we support auto-pagination: https://stripe.com/docs/api/pagination/auto?lang=dotnet
code here or into pastebin?
did that once checking in code to github... that was costly
var service = new PaymentIntentService();
bool fetch = true;
while (fetch)
{
fetch = false;
var payments = service.List(options);
foreach(var pay in payments)
{
Model.PaymentResponse obj;
response.Add(obj = new Model.PaymentResponse()
{
ID = pay.Id,
Status = pay.Status,
Created = pay.Created,
Description = pay.Description,
Email = pay.ReceiptEmail,
Amount = pay.Amount / 100
});
}
fetch = payments.HasMore;
if (payments.HasMore)
options.StartingAfter = payments.Last().Id;
}
return response;
hum that should paginate fine but I'm not sure what your response.Add does and how you turn that into a CSV
my advice is: log all payments ids to a file first and then check if what you have in the Dashboard is/isn't in the list?
var response = new List<Model.PaymentResponse>();
that is my own Model.
which I pass back to my calling code
which I run an insert into my DB
foreach (var pay in payment.List(lasttxn))
{
xobj.SetQuery("stripepaymentintent_insert");
xobj.SetParameter("pay_id", pay.ID);
xobj.SetParameter("pay_status", pay.Status);
xobj.SetParameter("pay_date", pay.Created);
xobj.SetParameter("pay_description", pay.Description);
xobj.SetParameter("pay_email", pay.Email);
xobj.SetParameter("pay_amount", pay.Amount);
xobj.SetParameter("create_date", DateTime.Now);
xobj.Query();
}
the id I should be dealing with is a pi_ id correct?
I'm wondering if my Linq last() is screwing me up. Gonna try something different there.
yeah that's why I recommend adding a log line inside the foreach to compare
but if you move to auto-pagination your life would be easier!
do you handle errors?
no one would "kick you out" but you might have a timeout for example and not properly handling errors https://stripe.com/docs/api/errors
I do. I'm in code testing... but let me see if I missed catching any.
I use the term lightly ๐
no errrors. could something be logged to the dev dashboard? have I exceeded a rate limit?
you can't exceed rate limits with sequential reads
sorry I can't really help without actionable information. Nothing "kicks you out" in our API without an error message
are we talking apples and oranges?
I'm downloading all payments from the UI and getting over 2,000 records. In code, I'm using the PaymentIntenService and Itterating over each payment from the List function and then checking and continuing when HasMore is true.
I'm setting my Starting after property like this:
fetch = payments.HasMore;
if (fetch)
options.StartingAfter = lastpay.Id;
lastpay looks like this (I've removed the Linq call)
PaymentIntent lastpay = null;
foreach(var pay in payments)
{
lastpay = pay;
I have to go... but I look forward to your response.
But I gave you multiple ideas of what to try. Auto-pagination is one, logging all payment intent ids in your code explicitly is a second one, and then comparing what you see in your export and diffing the list to find an example PI that was in the export and not your code export to understand the difference
I don't really have a better answer yet as it's mostly the same information as when we started, this is how you should debug this further
Hi @marble pivot I am trying to catchup. Can you update here again how did it go?
Yes, thanks. I'm basing my failure on the fact that in the Strip User Dashboard, under payments, when I export I have more than 2,000 entries.
When I use the library PaymentIntentService and I try to capture ALL entries I only retrieve 352.
First I was using my own paging mechanism, using StartingAfter and my own While loop (C# code) and now have tried a foreach with ListAutoPaging and I am getting the exact same result, 352 entries.
Maybe I'm barking up the wrong tree?
I believe you are in correct direction. In your code with AutoPaging, are you doing something similar to this?
var service = new CustomerService();
var options = new CustomerListOptions {
Limit = 3
};
// Synchronously paginate
foreach (var customer in service.ListAutoPaging(options)) {
// Do something with customer
}
// Asynchronously paginate
await foreach (var customer in service.ListAutoPagingAsync(options)) {
// Do something with customer
}
(It's from our API reference doc)
I'm not using the CustomerService API at all.
Unless you just copied that here as a similar example
ok, yep, doing exactly that.
okie that's weird. Do you have the request Id (from your Dashboard log)?
Also when you mentioned
I'm downloading all payments from the UI and getting over 2,000 records.
How did you download the payments? and do you have example payment that was not returned in your request?
Yes, WSW, I'm using the Export options under the Payments tab.
So every Payment (intent) including Successes and Failures.
(and whatever other status is pulled down)
yup, I mean have you compared the two list 2000 records <> 352 and see which ones are missing?
Those will be useful too to troubleshoot
Well, sure but I was thinking that since the difference in count is so large that there was a more obvious reason for the discrpency.
Which ID should I be looking for exactly?
My CSV download include ch_, cus_, and card_ ID types.
o, you only care payment_intent right?
ch_, cus_ and card_
shouldn't matter
because what your code are doing is to pull payments
i think that's the reason
Yes, payment_intent. I need a complete accounting of every success and failure payments to use in my system.
you've downloaded a bunch of unrelated objects
cus_, card_ are not payment
only pi_ matters
you should filter your csv and only count pi_xxxx
Oh, well that is what is available in the UI.
let me see
on the Payments download in the Stripe Dashboard, can I specify to download the pi_ data?
with a filter I mean? (looking now)
which dashboard page are you downloading things now?
Right, but that is was I need (in code and in my system) a complete accounting of every transaction (success or fail)
correct, that's the page you should use to export
and you should only care about the record with pi_xxxx
because that's the payment records
Ah! I added PaymentIntent column to my results and now I am seeing that not every row actually has a pi_ number
Gotcha. But @deft prairie I also need the Failed transaction attemps. I them in here and indeed, they do not have a pi_xxxx number
pi_xxx will contain status, status will tell you if they are successful
only succeeded ones are completed payment
I understand but I need a list of both succeeded and failed attempts. I need to download the failed attempts. Is this available in the API?
no
you have to list all the success and failed one, then filter and group them yourself
Wait. I'm confused. 1) I'm not seeing any Failed attemps when i use the .NET API to retrieve ALL PaymentIntents, only successful ones. and 2) I'm not clear if there is another approach, withing the API to fetch the FAILED attemps.
Are you sure you only get the successful one?
Yes, with the built in options, yes. Is there an option to expand my filter? Maybe be default in only produces succesful results?
In the API, tested now several times with 2 different approaches is 352.
ok, for this req_Po1d2qZIqTGTW5 you just shared
you are pulling payment_intent using this parameter
{
limit: "100",
starting_after: "pi_1JA4BtG30Vl6ne6NyuBHeL3p"
}
this pi_1JA4BtG30Vl6ne6NyuBHeL3p status is cancelled
it is not a successful payment
So you are saying that is not a good staring_after object?
what I am saying is that, listing payment_intent API will return all the payments including successful and failed one
this pi_1JA4BtG30Vl6ne6NyuBHeL3p is an example of failed one (due to cancellation)
Here is the 1st request in my attempt at using ListAutoPaging: req_LDjFPknJ5lAucg
These are the next 3: req_WQlTWtoyNxcx4W, req_CHEzNtQYeZWAUq, req_O2kEiz3e2xCYN7
Right, but what I am saying is, my request for the PaymentIntents is not retrieving the complete set of PaymentIntents.
I thought we cleared that up because the way export the the payment_intent?
cus_, ch_xxx and card_ are not payment_intent and you should not compare them
I'm not using the export in my solution, that is just a proof of concept. I am going after the data programatically.
ok, then how can you tell you are missing data then?
Ahh... I have a know customer who paid, their credit card was declined and I can't find their failed/declined PaymentIntent record.
do you have your customer email or ID?
yes. you can dm me
done
Ok, with the email, it is much easier
- non-coding way, you can go to your dashboard, and search the email address
xxxxx@xxxx.com
yes
it will show all the customer created using the email
actually this is better go to your https://dashboard.stripe.com/customers
filter by email xxxxx
you can find all the customers
I'm doing that already
then click into them and find all the payment done
Filters Status Failed.
there is no status
Perfect. Now how do I do this in code?
There is Status on the Payments dashboard.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
with email
- loop through the customer found, and list the payment_intent with the customer_ID
https://stripe.com/docs/api/payment_intents/list?lang=node#list_payment_intents-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So, for every customer, for every payment intent?
I can do that, but before I do that, are you saying that I can't get a list of failed payments using the API?
Your UI allows for it
which one does not contain failed one?
This code here, it only return Succeeded and Canceled, no Faield.
var service = new PaymentIntentService();
foreach (var pay in service.ListAutoPaging(options))
{
can you share the list of returned results?
this pi_1JA4BtG30Vl6ne6NyuBHeL3p was returned result and it failed
Status is cancelled. I will DM you.
its ok to discuss here, can you first try to implement by the customer
it will limit the returned list
since you want to check per customer
Wait.. I have an example of a failed payment intent but this failed payment intent is not showing up in the list of all PaymentIntetents I download. I not not want to loop through every customer. Why isn't this failed payment intent showing up in this list of all payment intents?
Can you reverse lookup the payment intent for the email I sent?
WAIT.. should I be looking at charges, success and failures instead?
Charge API will work too
Same thing, you will have to list charges by customer https://stripe.com/docs/api/charges/list?lang=node#list_charges-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Well, Payment API isn't working! Almost done with test code.
ok, have some to test.
ch_1IKNuUG30Vl6ne6Nb5Slc6FZ succeeded
ch_1IKAc0G30Vl6ne6NbKP4Qd3z succeeded
ch_1IK92dG30Vl6ne6NsEzCbwW9 succeeded
ch_1IK7UgG30Vl6ne6Nx8mLNYmq succeeded
ch_1IK23TG30Vl6ne6Ne5VqAnOP succeeded
ch_1IJqtlG30Vl6ne6NxISnl8gT failed
ch_1IJqr3G30Vl6ne6NWM9V103j failed
ch_1IJmLPG30Vl6ne6Nb1ZO0uSR failed
and I can retreive the balance transaction id, which is what I really really need.
ch_3JaQ7rG30Vl6ne6N0Ldo62ZP txn_3JaQ7rG30Vl6ne6N01BE7H01 succeeded
Hey @deft prairie I think I am all set! Thank you for all of this help. Goodnight. Bedtime here.