#JenniferJenna - Default Card

1 messages · Page 1 of 1 (latest)

marble musk
#

Hello! Can you provide more details about what "I then update the customer's default payment card." means? A request ID would be great if you can provide one.

dapper mural
#

I'm not sure where I would find that Id. The call to update the default card seems to work. Here is that code. C# and using the stripe libraries. I can see it is updated in the dashboard. Here is that image too.

#

var options = new CustomerUpdateOptions();
options.InvoiceSettings = new CustomerInvoiceSettingsOptions()
{
DefaultPaymentMethod = cardRequest.CardId
};
options.AddExpand(DefaultSourceProperty);

        Customer stripeCustomer;
        CustomerService customerService;
        try
        {
            customerService = await this.stripeServices.CustomerServiceAsync().ConfigureAwait(false);
            stripeCustomer = await customerService.UpdateAsync(cardRequest.CustomerId, options).ConfigureAwait(false);
        }
        catch (StripeException e)
        {
            throw this.CreateStripeUtilityException(e);
        }

        return this.mapper.Map<CustomerModel>(stripeCustomer);
marble musk
dapper mural
#

The logs only seem to show Posts. Prior to making the subsequent charge, I Get the customer to confirm they have a default card. That is the call that is failing.

#

I also tried the above code with options.DefaultSource = cardRequest.CardId to set the default card, but I get the same results when I try to retrieve it for a subsequent charge

marble musk
#

You can show GET requests as well by changing the filter option at the top.

#

Err, Method option.

dapper mural
#

ha 🙂 req_TfOpsWKz3og15a

marble musk
#

Awesome! Taking a look...

#

Payment Methods cannot be set as a default_source, as that property is legacy for our older Token/Card/Source objects.

#

Does that help?

dapper mural
#

well not exactly. What if I try the other way? Should that work? Ie,
options.DefaultSource = cardRequest.CardId
Basically, I need to set the card they used on their initial intent as their default for re-charges. How can I accomplish that?

marble musk
#

That depends on several factors... are you using a mix of legacy objects (Tokens/Cards/Sources) and new ones (Payment Methods)? How are they being re-charged?

dapper mural
#

I am just using payment intents. So when they setup a paymentIntent the first time, I create a customer and associated with the intent. Then the UI calls Confirm and the card is created, and associated with the customer and the payment goes through.
Then when they re-charge I create a new paymentIntent, but first I look up the customer to grab their default card. That's where my problem is.

marble musk
#

Okay, so you need to look at the Customer's invoice_setting.default_payment_method and not use default_source at all.

dapper mural
#

Okay, so the code to set the card is correct then. Let me try to see if I am retrieving it correctly.

dapper mural
#

Thanks Rubeus. I have some re-mapping and setup to do. It's kinda late here, so I will ensure that I'm looking at invoice_setting.default_payment_method in the morning, and confirm success w/you.

marble musk
#

Sounds good!