I am using Stripe Checkout to process orders on my site and then save the order once its complete using the webhook Checkout.Session.Complete . It works all well and good but I would like to store the last 4 digits used to process the order. If I send a receipt using Stripe it lists that info so I know its possible, I just prefer to store it and send my own receipt to customize and assist customers if an order is off. The checkout session object doesnt list the last 4 digits for some reason so whats the best way to get that info based on what the session object returns???
The answer will depend on the type of Checkout Session you are working with.
If you are working with Checkout Sessions where mode:payment, then you should expand payment_intent.payment_method when you retrieve the Session. Then, you can check payment_intent.payment_method.card.last4 to get the last 4 digits.
If you are working with Checkout Sessions where mode:subscription, then you should expand subscription.default_payment_method when you retrieve the Session. Then, you can check subscription.default_payment_method.card.last4.
If you're not already familiar with expansion, you can read more about it here (https://stripe.com/docs/expand).
Related
Let's say I'm getting payouts information https://stripe.com/docs/api/payouts/list
I want to get the destination info, so if we take the example from the docs:
I want the details from that destination, I don't mean the specific details like the exact credit card number, but the info when going on the page itself, this one:
It's not working listing the banks accounts https://stripe.com/docs/api/customer_bank_accounts/list , I'm getting zero results when list them all
I'm using Golang library but I think this solution can be solved by others programming languages
I'm also using expandable fields but I get blank results on bank_account and card details
what is interesting however, is when debugging the page, they make request to v1/payouts/{id} with expand[]: balance_transaction and the returned data contains the bank information, but when I do it with their API, that info is not returned back
The Payout destination is expandable, meaning you can have it replaced with the full object by sending you request with expand[]=destination or for a list command data.destination.
My app uses subscriptions with Stripe.
I want to create a standard "account" page, which will list the customer's current card information (like "MasterCard" and last 4 of card number), and give the customer the option of updating that information.
I'm stuck on the first piece--getting back the current card information. To do this, I need the current card_id. I have tried the "listSources" method, but this returns blank data where the card info is supposed to be. What do I need to do to get that card info?
Here is what I've tried:
(I'm using Node, and running this server side)
The closest method I have found is here:
var stripe = require('stripe')(STRIPE_TOKEN);
stripe.customers.listSources(
CUSTOMER_ID,
{object: 'bank_account', limit: 3},
function(err, cards) {
// asynchronously called
}
);
This returns information (there's no error), but the docs say this method should return a data array of the cards that includes the card id for each. In testing, the data array keeps coming back empty.
I am testing with a customer id that has a valid subscription and a card that I can see on my Stripe dashboard.
Why is the data array coming back empty?
Note: there's also a retrieve source method, which should give back card details, but this method requires you have the id of the card you want info on, and that's what I am not able to get right now.
Converting this to an answer...
Stripe has recently rolled out PaymentMethods, which replace (and are separate from) the older Tokens and Sources API.
OP's issue is that their integration creates PaymentMethod objects, which won't show up in the sources list, but can instead be accessed via stripe.paymentMethods.list.
I'm working on load testing a web application that sends links via email. I have a gmail account set up specifically to be the recipient for this. When generating new accounts I add a guid to the recipient email (eg. loadtest_nmndbiwpdi#gmaildomain.com). When I execute the test it will either succeed entirely or fail entirely, but failures seem to be pretty random.
Here is my search snippet:
if (!inbox.isOpen()) {
inbox.open(Folder.READ_ONLY);
}
SearchTerm toTerm = new RecipientTerm(RecipientType.TO, new InternetAddress(to));
messages = inbox.search(toTerm);
While the script is running, it executes this in a 100 iteration loop with a 3 second pause. When it's failing script output with imap debugging on repeatedly shows the following:
A4 SEARCH TO loadtest_nmndbiwpdi#gmaildomain.com ALL
* SEARCH
A4 OK SEARCH completed (Success)
But no actual result. during the period of execution, however, I can do a search in gmail for this recipient and it pops right up. Any suggestions for getting to the bottom of this?
Gmail doesn't exactly implement the IMAP spec, especially for searching. Gmail searches are always for whole words, although that shouldn't be a problem here.
You can try using the Gmail-specific support in JavaMail, e.g., the GmailRawSearchTerm class.
I implemented a local cache. I initialize it at the beginning of the load test scenario, downloading the last days messages and capturing the last messages UID (using gmail imap plugin). Any time a session looks for an email it looks in the local cache. If it's not there it sets a flag so other sessions don't overlap caching and retrieves the newest messages.
Because it was intermittent, I wanted to give it a few days. It's run perfectly for the past 4 days. I could probably go one step better and set up a listener on the folder for new mail, but for now I'm satisfied that gmail was just returning 'success' but not doing the search after so many imap searches in succession.
Thanks to all for your feedback and suggestions!
I have a merchant account on Google checkout. I can view all the orders buyers put when I log on to https://checkout.google.com/sell/orders. From there, I can search for a specific order number and view details about it.
I want to do the same programmatically, but after looking through the checkout API I can not find anything related to this issue. Basically my input will be an order number and the output I want will be details regarding that ordre, or at least a boolean indicating whether that order exists or not.
One option is to use the Order Report API to download a list of Google Checkout orders into a CSV file, then search localy. You are limited to the last 31 days.
https://developers.google.com/checkout/developer/Google_Checkout_XML_API_Order_Report_API
We need to fetch the items added/updated after the user's last visit.
We need this information from 3 separate lists under the same web.
Pointers on how to accomplish this would be very helpful (and does SharePoint provide any API for this).
Kind regards,
Filtering by modified date is straightforward enough, though the method will depend on the type of view - the tricky part is getting the last login time - you're probably going to need a bit of custom code to save that.
Brute force would be to run a foreach on every version until you reach a version before the users last login date, and do this on every list item, and then again on every list. You can see which fields changed this way by seeing what changed between versions. You can narrow down the the set of items to do this on by only querying for ones with a modified date since the users last login
As for finding the users last login, sorry I can suggest anything for that. I've not looked for it before.