#laurids kern - customer information

1 messages ยท Page 1 of 1 (latest)

burnt yoke
#

What information are you looking for, exactly?

#

The billing address details reside on the payment method object, for example

compact bramble
#

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

burnt yoke
#

Do you mean a receipt?

#

Invoices are something you create before payment, not retroactively

compact bramble
#

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?

burnt yoke
compact bramble
#

thats a bummer, stripe attaches an invoice to a subscription item too, why is this not possible for checkout

burnt yoke
#

Well if you use checkout for subscriptions it will, subscriptions use invoices to collect payment

#

But now one time payment session on Checkout

compact bramble
#

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?

burnt yoke
#

You can collect taxes for one time payments via checkout, that is supported -- you just can't get an invoice for it

compact bramble
compact bramble
modern bluff
#

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

compact bramble
#

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

modern bluff
#

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

compact bramble
#

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

compact bramble
#

unfortunately I didnt know it was required

modern bluff
#

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

compact bramble
#

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

modern bluff
#

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?

compact bramble
#

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

modern bluff
#

so you might be looking at diff things

billing_details is a hash present on the PaymentMethod (that can be attached to a Customer)

compact bramble
#

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

modern bluff
#

mind sharing details like customer and PaymentMethod IDs and which address fields exist on which?

compact bramble
#

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

modern bluff
#

looking

compact bramble
#

thanks ๐Ÿ™‚

normal nova
#

Hello. Taking over for hmunoz. Give me a moment to catch up here

compact bramble
#

thanks!

normal nova
#

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

compact bramble
#

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

normal nova
#

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

compact bramble
#

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

normal nova
#

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

#

Then grab their address from the paymentintent

compact bramble
#

but the payment intent doesnt include the billing adress

normal nova
normal nova
#

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

compact bramble
#

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

digital verge
#

Hey there ๐Ÿ‘‹
codename_duchess had to step away
Catching up on the thread

compact bramble
#

thanks

verbal oasis
#

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

compact bramble
#

**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

verbal oasis
#

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

compact bramble
#

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?

verbal oasis
modern bluff
#

@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

compact bramble
#

ah i forgot about expanding

#

thanks