stevec
stevec

Reputation: 52308

Set default country for phone number field in Stripe Connect onboarding?

This is pretty minor, but for better UX, during stripe connect onboarding, I would like the phone number field to default to the connected user's country (just like the address field does). How can I make this happen? Note that I do not have the user's phone number, so I can't provide it as a parameter to Account.create()

Reproducible example

Create an new account and onboarding link

country = "US"

Stripe.api_key = Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_stripe_test_key] 

account = Stripe::Account.create({
  country: country, 
  type: 'express',
  capabilities: {
    card_payments: {
      'requested': true,
    },
    transfers: {
      'requested': true,
    },
  },
  settings: {
    payouts: {
      schedule: {
        interval: "manual"
      }
    }
  }
})

account_links = Stripe::AccountLink.create({
  account: account.id,
  refresh_url: 'https://example.com/reauth',
  return_url: 'https://example.com/return',
  type: 'account_onboarding',
})

When visiting the onboarding link (i.e. via account_links.url), despite the account's country being "US", the phone number defaults to Australia:

enter image description here

Question

How can I make the phone number field default to the country of the account?

Note

The address field does default to USA, as desired:

enter image description here

Upvotes: 2

Views: 1013

Answers (1)

Rojan Kobani
Rojan Kobani

Reputation: 11

Unfortunately, you can not make stripe set country code for phone field based on country parameter you have sent. Stripe does not consider the country parameter for setting phone. If phone field is null, then it fills it automatically.

Upvotes: 0

Related Questions