stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.25k stars 639 forks source link

Unable to add Both Individual and Company Params to AccountParams #7602

Open noushad-newagesmb opened 10 months ago

noushad-newagesmb commented 10 months ago

Summary

I am requesting support for adding both individual and company parameters to the AccountParams class in the Stripe Android SDK. Currently, it seems that creating an AccountParams instance with both sets of parameters is not straightforward, while this feature is available in the iOS SDK. According to the latest update from Stripe, to verify information with the IRS, the legal name and tax ID are required. However, when using the Stripe Android SDK, it's currently not possible to include both company parameters and individual parameters in a single AccountParams object.

The create function in AccountParams accepts either individual or company parameters. There are no errors during token creation, and the test logs indicate successful requests. However, the callback returns a pending status with the name and tax ID pending, as they are not included in the token, leading to a pending status in connected account creation. The following structure is required for creating an account token

Code to reproduce

Android version

Impacted devices

Installation method

Dependency Versions

kotlin: 1.9.0 stripe-android: 20.34.4 Android Gradle Plugin: 8.0 Gradle: 8.0.2

SDK classes

Video

Other information

### Tasks
seanzhang-stripe commented 10 months ago

Hi @noushad-newagesmb The AccountParams allows you to specify some information about the account, and use them when creating a Connect Account. However, the mobile SDK doesn't provide APIs for document upload nor account verification. Your application should collect the required document and submit them to Stripe during the onboarding process, and it's recommended to use Account Links API for onboarding.

I'm closing this ticket because it's outside the scope of Stripe Mobile SDK. Feel free to re-open it or reach out again if you have any follow-up questions.

noushad-newagesmb commented 10 months ago

Hi @noushad-newagesmb The AccountParams allows you to specify some information about the account, and use them when creating a Connect Account. However, the mobile SDK doesn't provide APIs for document upload nor account verification. Your application should collect the required document and submit them to Stripe during the onboarding process, and it's recommended to use Account Links API for onboarding.

I'm closing this ticket because it's outside the scope of Stripe Mobile SDK. Feel free to re-open it or reach out again if you have any follow-up questions.

While creating an account token, the account params accept either a CompanyParams or IndividualParams object only. Refer to the sample JSON structure below we need for creating a token:

{
  "account": {
    "tos_shown_and_accepted": "true",
    "individual": {
      "dob": {
        "year": "****",
        "day": "*",
        "month": "**"
      },
      "id_number": "*********",
      "ssn_last_4": "****",
      "phone": "*****",
      "first_name": "ABC",
      "address": {
        "line1": "test",
        "state": "Alabama",
        "postal_code": "08540",
        "city": "test",
        "country": "US"
      },
      "email": "abc@newagesmb.com",
      "last_name": "D"
    },
    "company": {
      "tax_id": "***********",
      "name": "ABC"
    },
    "business_type": "individual"
  }
}

To achieve this, we need to create AccountParams using both IndividualParams and CompanyParams.

For creating AccountParams and generating a token, please refer to the provided code. If you have specific code that needs correction or improvement, feel free to share it.

val accountParams = AccountParams.create(
                true,
                Individual(
                    address = Address.Builder()
                        .setCity(city)
                        .setCountry("US")
                        .setLine1(address)
                        .setPostalCode(zip)
                        .setState(state)
                        .build(),
                    firstName = fName,
                    lastName = lName,
                    email = email,
                    phone = phone,
                    ssnLast4 = ssn,
                    dateOfBirth = DateOfBirth(dobDay, dobMoth, dobYear)
                )
            )
//code for creating token using account params
stripe.createAccountToken(accountParams,
                callback = object : ApiResultCallback<Token> {
                    override fun onSuccess(result: Token) {
                        // use account token to create a Connect account server-side
                    }
                    override fun onError(e: Exception) {
                        e.printStackTrace()
                    }
                }
            )
seanzhang-stripe commented 10 months ago

Hi @noushad-newagesmb thanks for the example code and the additional context. Yes this is a limitation in Stripe Android SDK that you can't specify both company and individual in an AccountParams , I've put this request to our backlog and reopened the ticket.

The workaround here is to call the /v1/tokens API in your backend to create an account token.