#rp-invoice-paymentmethod

1 messages ยท Page 1 of 1 (latest)

frank harnessBOT
slender parcel
#

looking

brave elbow
#

thank you!

slender parcel
#

If you look at that object it has source: 'card_123' which is part of a legacy integration overall

brave elbow
#

Hmm is that because my stripe API version is behind then?

slender parcel
#

It seems you did this manually from the Dashboard maybe which uses an older integration path to not break existing merchants

#

rp-invoice-paymentmethod

#

no not really related to your API version, just you manually testing in the Dashboard from what I can tell

brave elbow
#

This should have been created via the stripe API

#

Hmm yeah just double checked, I'm almost certain we created this invoice through the stripe API

slender parcel
#

you paid it in the Dashboard right?

brave elbow
#

Oh I see

#

Yeah just noticed that part

slender parcel
#

you also attached that card in the Dashboard

#

and that flow uses an older integration path sadly

frank harnessBOT
brave elbow
#

Got it, that makes sense

slender parcel
#

so you kinda have to account for both situations in this case

brave elbow
#

So in this case, we should be looking at the Source field?

#

And thanks for the explanation! I didn't realize those actions had taken place in the dashboard

slender parcel
#

none of this is documented unfortunately it's really legacy ๐Ÿ˜ฆ

brave elbow
#

Ah gotcha

#

Is there a way to migrate this object to the payment_method field?

#

if its possible, we'll make sure not to do this again in the future

slender parcel
#

You can update the Customer and set invoice_settings[default_payment_method]: 'card_123' if you do that it will use the right integration path

#

so maybe your code should listen for Customer related Events like customer.created and customer.updated so that whenever a new "card" gets attached in the Dashboard you can see default_source: 'card_123' on that Customer (old and legacy but what the Dashboard does) and the go and immediately update the parameter I mentioned above to fix it

brave elbow
#

Hmm gotcha, that would fix it for future invoices created on the Customer right?

#

Is there a way to fix this on the existing invoice?

balmy badge
#

What do you mean by fix, specifically?

#

For already paid invoices, there's nothing you can change

#

You'll need to check both payment_method and source

brave elbow
#

Gotcha, hmm

#

We're using the go SDK and the source field doesn't exist in the generated struct types at all, so I was hoping we could somehow migrate the existing invoice to the payment_method field

balmy badge
#

Gotcha, that makes it a little harder because yes it's been deprecated

#

But you can access that field from the raw response data

brave elbow
#

Unfortunately I think it'll be a huge lift to pipe the raw response through to all the places we're accessing the invoice struct type, but we'll find another workaround

#

thanks for the explanation, appreciate the help ๐Ÿ™‚

balmy badge
#
pi, _ := paymentintent.Get("pi_123", nil)

var rawData map[string]interface{}
_ = json.Unmarshal(pi.LastResponse.RawJSON, &rawData)
rawData["source"] // might need to be cast
#

We provide LastResponse.RawJSON so you should be able to traverse that as needed, the above is just an example

brave elbow
#

Oh awesome, ok thanks a lot!

#

That makes it a lot easier, thanks again ๐Ÿ™‚

balmy badge
#

NP!