#laurids kern - customer information
1 messages ยท Page 1 of 1 (latest)
What information are you looking for, exactly?
The billing address details reside on the payment method object, for example
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay I will try that then, thanks.
Is there a way to generate an invoice for a payment intent after it was paid? I havent found a way to do so
because the whole reason why I'm doing this is that I need an invoice for each payment, which strangely only exists for subscriptions and not one time payments. Now for tax reasons I need an invoice for each payment and want to generate one
that would definitely be easier if I could just generate one but as far as I understand this is only for unpaid invoices
Do you mean a receipt?
Invoices are something you create before payment, not retroactively
i mean an invoice, but when I use checkout I cannot generate a receipt & use the normal checkout flow
stripe invoice can only be created and charged and created and sent per email afaik
is there a way around this?
Invoices and checkout are separate, that's correct. You can create Invoices and send you customers to the hosted invoice page to pay, though, which is similar to Checkout (not not the same):
https://stripe.com/docs/invoicing/hosted-invoice-page
thats a bummer, stripe attaches an invoice to a subscription item too, why is this not possible for checkout
Well if you use checkout for subscriptions it will, subscriptions use invoices to collect payment
But now one time payment session on Checkout
hm checkout should use invoices too imo makes it almost impossible to tax this properly without an invoice.
on another note, i tried fetching paymentmethod but it is always empty
thanks for all the help btw
does checkout automatically attach the paymentmethod object to the customer?
You can collect taxes for one time payments via checkout, that is supported -- you just can't get an invoice for it
its about paying income tax not vat i need an invoice for that unfortunately
is this maybe why none of my customers have a paymentmethod object attached
catching up here
checkout should use invoices too imo makes it almost impossible to tax this properly without an invoice.
Checkout doesn't do one off Invoices. You can create a one off Invoice programatically instead and send it to a customer
yeah, it would be way easier if collection worked through checkout, since in order to create and send an invoice I need the customer info which I am collecting through checkout otherwise I would have to use stripe elements or something the create a custom checkout and then create an invoice
but anyways since this is not possible I am building my own invoice pdf generator for internal use but I am still having issues getting all the customer info
does checkout automatically attach the paymentmethod object to the customer?
it should if you passedpayment_intent_data.setup_future_usageon the CheckoutSession https://stripe.com/docs/api/checkout/sessions/create?lang=curl#create_checkout_session-payment_intent_data-setup_future_usage
something the create a custom checkout and then create an invoice
An Invoice has a hosted invoice page url that you can send the customer
it is a pre build payment page
I see it would be kinda awkward tho to have the customer "checkout" and then just receiving an email with their invoice. I was looking for something more of a ecommerce checkout experience like with stripe checkout
I am not passing this atm
unfortunately I didnt know it was required
then just receiving an email with their invoice.
that is one option but not what I meant
you create an invoice, you have the hosted url link you can just redirect your customer to that immediately
ohh I see that makes sense
I might do that in the future thanks! but for now I still need to get access to my current customers data so I can create the invoices manually
so payment method object is empty, customer address is empty on some customers as well but under "checkout summary" I can see the billing adress properly
is there any other way to access the adress
for example I can see it in the dashboard but I just cant fetch it through the api
let's take some steps back
my recommendation was that you just use the hosted Invoice page and that collects the PaymentMethod details for you
are you trying to figure out how to get a PaymentMethod from a Customer who paid but the PaymentMethod was never attached to them?
I am trying to manually get historic data in order to generate a pdf invoice so I can use this for my accounting.
the billing data (adress name etc) is available for ALL customers when I look at the successfull payment intent, however some of the customers dont have the billing info attached to the customer object
this doesnt make any sense
so you might be looking at diff things
billing_details is a hash present on the PaymentMethod (that can be attached to a Customer)
I have the billing details for each customer but they are somehow not merged together
this is only for about half the customers though, the other half has everything attached to their customer object
I just need a way to get the billing adress for each customer and it seems to exist somewhere I just dont know where
additionally the customer has a payment method where I could get the billing adress from but trying to fetch it with "stripe.customers.listPaymentMethods" returns nothing
mind sharing details like customer and PaymentMethod IDs and which address fields exist on which?
sure do you need just the ids?
**customer1: **cus_IxbudMSWsmM1Kv, paymentmethodID: pm_1ILggqBbqKPfJMetUjbZyMpu
PaymentIntendId (that includes the relevatnt info): pi_1ILgfkBbqKPfJMet61qtG9Mc
this is an example for a customer that doesnt have the billing adress attached properly
**customer1: **cus_L60ihbMxHg94zw, **paymentmethodID: **doesnt have one
**PaymentIntendId (that includes the relevatnt info): **pi_3KPoU4BbqKPfJMet0XClBHcj
this is an example for a customer that has billing details attached to it but doesnt have a payment method safed somehow
looking
thanks ๐
Hello. Taking over for hmunoz. Give me a moment to catch up here
thanks!
Ok so the address on the customer object is going to actually be different than the billing address set on the payment method. To set it on the customer object itself, it's the customer.address property: https://stripe.com/docs/api/customers/update#update_customer-address. Once set, that will show up on the customer's page when you click it on the 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.
That can actually be different than the one set on the payment method that's attached to the customer: https://stripe.com/docs/api/payment_methods/update#update_payment_method-billing_details
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay but the data is available either way since all "successfull" payment intents show an adress under "checkout summary"
I just need a way to access this for all historic sucessfull payment intents
so what ways are there for me to acccess this data ?
payment method always returns empty
and the customer only includes the info half the time
I always created customers the same so this differences must lead back to some change at stripe i think
Looking into why the payment method wasn't attached for that one customer. One moment
But for that second customer, it looks like you passed in billing_address_collection: "required", to create the checkout session, but that wasn't passed in for the first customers checkout session. That might explain why you see an address on the second customer
okay that would make sense
but checkout summary is still showing the adress for all of them
so the data exists somewhere
I was hoping to get it via the PaymentMethod Object but it seems that only a few customers have this object
Still looking into the cause of that
But if you just want the address, you can grab it from the PaymentIntent objects instead of the Customer objects
That could be a reliable way to fetch the addresses
So you can reliably grab the billing address from the paymentintent. You could filter paymentintents by customer: https://stripe.com/docs/api/payment_intents/list#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.
Then grab their address from the paymentintent
but the payment intent doesnt include the billing adress
You can retrieve the paymentintent and expand the payment method to see it: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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 I found out why some of your customers don't have the payment method attached and some do. The old behavior for checkout sessions in "payment" mode from a year ago automatically attached the payment method to the customer. That behavior has since been changed, and we sent out communications about the behavior change a year ago. Now, to attach the payment method to a customer when creating a checkout session in payment mode you have to set it up for future usage: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay thanks, I will note that for the future altough it seems since that change customers got their adress safed to the customer object anyways.
But how do I access the address for past purchases now, I just need to access them so I can generate my invoices
because they don show up even for the older purchases
Hey there ๐
codename_duchess had to step away
Catching up on the thread
thanks
Do you have an example ID of a payment I can look at for this? I am unsure where the details might be stored for this if the payment method is not attached
**customer1: **cus_IxbudMSWsmM1Kv, **paymentmethodID: **pm_1ILggqBbqKPfJMetUjbZyMpu
**PaymentIntendId (that includes the relevatnt info): **pi_1ILgfkBbqKPfJMet61qtG9Mc
this is an example for a customer that doesnt have the billing adress attached properly
**customer1: **cus_L60ihbMxHg94zw, **paymentmethodID: **doesnt have one
**PaymentIntendId (that includes the relevatnt info): **pi_3KPoU4BbqKPfJMet0XClBHcj
this is an example for a customer that has billing details attached to it but doesnt have a payment method safed somehow
Awesome thank you. Checking in to those
The Customer does not have a payment method attached but the payment intent does, so you should be able to get the address data from there
For this payment intent pi_3KPoU4BbqKPfJMet0XClBHcj
I can see this payment method pm_1KPogpBbqKPfJMetlwfoKjhs
Which has billing address details on it
ohh okay so currently i do "stripe.customers.listPaymentMethods"
wait so U use the paymentMethod ID of the payment intent right
because the intent object doesnt include the full payment method object
only the id
right?
Right, though as codename_duchess pointed out, you can get them both in one call if you use expansion while retrieving them https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
@compact bramble that is expected, the PaymentMethod object lives on the PaymentIntent
so you have to go from CheckoutSession -> PaymentIntent -> PaymentMethod using what Pompey linked above
that was detailed here #943903062462976041 message