#Nick - Add Credit Card (Not Default)

1 messages · Page 1 of 1 (latest)

winged rampart
#

Alright, just to double check, you are using the PaymentMethod, Subscription, and Invoice APIs correct?

upper coyote
#

The credit cards are added via a SetupIntent

#

But yes, Subscription and Invoice API's

#

Basically, we have 2 products. One you can host yourself, and one that we host for you in the cloud. What's happening is, some customers will sign up for the self-hosted version, pay with their card, but then that card is automatically the default payment. Later, they sign up for a trial of our cloud product (no credit card acquired), but the subscription points at the default payment method, which I don't really want

winged rampart
#

Okay so when you assign a payment method to a subscription it doesn't automatically make that the default payment method.

upper coyote
#

but it seems that if there is no payment method, and you add one via a setupintent, Stripe automatically marks it as the customer invoice settings default source

#

Unless I'm misunderstanding you? You have to do the setupintent to get the payment method ID, and then you can assign that payment method to the subscription you create, but at that point it's already been made the default AFAICT

winged rampart
#

Not as far as I am aware. Each subscription can have a payment method specified.

upper coyote
#

I'll read through the doc and play around with it a bit more. Maybe come back with some more questions later

#

Thanks for your help!

#

So this doc looks to be more about payment methods where I'm talking about payment sources

#

Our only payment method is credit card

winged rampart
#

I'm still trying to figure out how the this becoming a default, because that is not the default behavior

#

Are you using the Source API?

#

Rather than the PaymentMethod API?

upper coyote
#

It sets the card up for future payments (renewals, expansions, etc)

#

The card itself is captured by your iframe component. Maybe I'm not understanding the question because that's abstracting?

winged rampart
#

Okay but for the Setup Intent you are attaching a payment method. Are you using the Card or Source or PaymentMethod API to generate that value?

upper coyote
#

I'm going to say PaymentMethod, because I have this code

        const result = await confirmCardSetup(
            paymentSetupIntent.client_secret,
            {
                payment_method: {
                    card: billingDetails.card,
                    billing_details: {
                        name: billingDetails.name,
                        address: {
                            line1: billingDetails.billingAddress.address,
                            line2: billingDetails.billingAddress.address2,
                            city: billingDetails.billingAddress.city,
                            state: billingDetails.billingAddress.state,
                            country: getCode(billingDetails.billingAddress.country),
                            postal_code: billingDetails.billingAddress.postalCode,
                        }
                    }
                }
            }
        );

For confirming the card setup

#

confirmCardSetup is the stripe Javascript library function

#

Sorry if I'm difficult lol

winged rampart
#

No worries.

#

I'm just trying to understand what objets you are working with. Because with the PaymentMethod object and SetupIntent, we do not make that payment method the default.

#

Defaults can be set on a customer's Invoice settings but it sounds like you don't want any default behaviors

upper coyote
#

Yeah exactly, don't want any default behaviours

#

That's the test customer I'm working with, if the event and logs help you out. I'll run through a quick scenario to get the data bootstrapped, one sec

winged rampart
#

Okay! I think we found something.

upper coyote
#

Yeah I just ran through and see that the payment method isn't actually a default. I must have done something after my test run to trigger that

#

Ok, cool, then this will probably work for me, just gotta iron out the bugs. Thanks a lot!