#papiwablo

1 messages ยท Page 1 of 1 (latest)

mystic mortar
#

Hi there, it's not at the client side. If you want to save a payment method, you should specify a customer and set setup_future_usage when creating a PaymentIntent at backend

drifting slate
#

so im doing this. card saves just fine. but i want to indicate that the card im saving for use is ALSO the default

mystic mortar
#

There's no default payment_method. You need to specify a payment_method when creating a PaymentIntent

drifting slate
#
{
  "paymentMethods": {
    "object": "list",
    "data": [
      {
        "id": "pm_1LxNwuL6jsOpWNAQK9CYyUQj",
        "object": "payment_method",
        "billing_details": {
          "address": {
            "city": null,
            "country": "US",
            "line1": null,
            "line2": null,
            "postal_code": 30309,
            "state": null
          },
          "email": null,
          "name": null,
          "phone": null
        },
        "card": {
          "brand": "visa",
          "checks": {
            "address_line1_check": null,
            "address_postal_code_check": "pass",
            "cvc_check": "pass"
          },
          "country": "US",
          "exp_month": 12,
          "exp_year": 2023,
          "fingerprint": "EMamlMtwKaSoRgV0",
          "funding": "credit",
          "generated_from": null,
          "last4": 4242,
          "networks": {
            "available": [
              "visa"
            ],
            "preferred": null
          },
          "three_d_secure_usage": {
            "supported": true
          },
          "wallet": null
        },
        "created": 1666845852,
        "customer": "cus_MglTCYooFBQ8z8",
        "livemode": false,
        "metadata": {},
        "type": "card"
      }
    ],
    "has_more": false,
    "url": "/v1/payment_methods"
  },
  "defaultPaymentMethod": null,
  "newSetupIntent": {
    "cs": "seti_1LxPH9L6jsOpWNAQXQHN75w8_secret_Mgmq9Mrx99HLix5RaoiWbfBCheA3Lz2",
    "ceks": "ek_test_YWNjdF8xSkRXVFRMNmpzT3BXTkFRLG1yU1pSc09aYlpIYldHQ0FyVFYyQ256ZTdyY2htckc_0014f5BUW7",
    "pk": "pk_test_51JDWTTL6jsOpWNAQGXADflKOrNobu3QpR1vyc3Hsdy84K16G9NGBfnTcfK2HMYMF3y8LSpuuPhWWJxLHxWi8F34V00YvPoRlf9",
    "cus": "cus_MglTCYooFBQ8z8"
  }
}
#

are you saying that

"defaultPaymentMethod": null,

can ONLY be set from a payment intent, not a setup intent?

#

so in order to "assume" a default payment method when just saving a future payment method, would be to grab the element at paymentMethods: -> data: -> id:

#

our users input and save their card for future use. but when i later on show them their "default" (yes and only payment method) i guess we could just assume a list of 1 could just be default

#

rather than looking to the defaultPaymentMethod's element

#

but if what a user saves multiple cards? how can they set the default from the iOS client?

mystic mortar
#

You can save a payment_method ID to your own DB and use it as the default payment_method for a customer

drifting slate
#

so to ask again

#

setting a payment method to be the default method can only be done from a payment intent, not a setup intent?

mystic mortar
#

Hmm, the main purpose of a setupIntent is to collet a payment method from customer. What's your use case of setting a payment_method to a setupIntent?

drifting slate
#

when a user goes through our full sign up process

#

we capture their full information and a credit card before they can continue

#

so in the future, when it comes time to buy, that payment method that was saved during the setup intent can be listed. however i'd like to be able to indicate that the method saved is the default

mystic mortar
#

Ok, so you want to use setupIntent to collect a payment method (without charging), attach it to a customer and flag it as the default payment method in your own DB?

drifting slate
#

we want YOU to flag it

#

we do not house or hold ANY payment method stuff on the back end

#

you have a return value for listing payment methods

#

"defaultPaymentMethod":

#

right now it comes back as null after saving a payment method

#

so i am asking, if the setup intent will allow me say "hey this payment method were saving for the future, lets make this the default"

mystic mortar
#

There's no default_payment_method property for a customer. If you believe it should be a feature request, you can let Stripe support know about it https://support.stripe.com/contact

drifting slate
#

yeah that should totally be a thing

#

because now the front end guy, has to filter through this ugly json return and grab the elements needed when and if there is only a single set of card values returned

#

whereas if that return was just keyed

#

it would be perfect

#

additionally maybe you can help with this as well

#

"defaultPaymentMethod": null, -> what eventually will be the element for this keyvalue? payment token?

mystic mortar
#

I don't see defaultPaymentMethod in our public API reference. Are you using a 3rd party SDK, or is it coming from your own code?

drifting slate
#

my belief is that this return is directly from "/v1/payment_methods"

#

so this should be a return directly from stripe

#

but i see your confusion as i dont see that listed as a return

#

let me try to check with back end as to the source of that key

mystic mortar
drifting slate
#

i am checking that as well

#

also

#

you are all snake case

#

this is a camel key

#

this looks like my back end guy put some of his own shit in this

#

this smells like my back end people mucked with the return

#

because we even just told one of them on a call to stop using camel case when in python

#

WELL

#

i do believe a setup intent should allow for this

#

however i dont think this is your problem any further

#

thank you for your thorough help

#

i really appreciate it

#

im gonna go yell at our back end lead now ๐Ÿ™‚

#

thank you