Why Won't The Latest Version Of Stripe Gradle Allow .setName?

- 1 answer

I am trying to integrate Stripe payments and the latest version for gradle stated to be com.stripe:stripe-android:9.2.0. Yet I am not able to use the .setName function to add to the card data. Why is this the case? I had to revert to an older 9.1.1 version to be able to accomplish this.

My code currently looks like this:

Card cardToSave = mCardInputWidget.getCard();
                Card.Builder builder = new Card.Builder(cardToSave.getName()); // pass the arguments here
                Card newCard =;

                Stripe stripe = new Stripe(paymentContext, publishableApiKey );
                stripe.createToken(newCard, publishableApiKey, new TokenCallback() {
                    public void onSuccess(@NonNull Token result) {
                        // Create plan

                    public void onError(@NonNull Exception e) {
                        // Handle error


I figured it out when you use constructor it receives name as argument. On the latest library com.stripe:stripe-android:9.2.0 it changes the way it was before

private Card(@NonNull Builder builder) {
    this.number = StripeTextUtils.nullIfBlank(normalizeCardNumber(builder.number));
    this.expMonth = builder.expMonth;
    this.expYear = builder.expYear;
    this.cvc = StripeTextUtils.nullIfBlank(builder.cvc); = StripeTextUtils.nullIfBlank(;
    this.addressLine1 = StripeTextUtils.nullIfBlank(builder.addressLine1);
    this.addressLine1Check = StripeTextUtils.nullIfBlank(builder.addressLine1Check);
    this.addressLine2 = StripeTextUtils.nullIfBlank(builder.addressLine2);
    this.addressCity = StripeTextUtils.nullIfBlank(builder.addressCity);
    this.addressState = StripeTextUtils.nullIfBlank(builder.addressState);
    this.addressZip = StripeTextUtils.nullIfBlank(builder.addressZip);
    this.addressZipCheck = StripeTextUtils.nullIfBlank(builder.addressZipCheck);
    this.addressCountry = StripeTextUtils.nullIfBlank(builder.addressCountry);
    this.last4 = StripeTextUtils.nullIfBlank(builder.last4) == null
            ? calculateLast4(number, builder.last4)
            : builder.last4;
    this.brand = asCardBrand(builder.brand) == null
            ? calculateBrand(builder.brand)
            : builder.brand;
    this.fingerprint = StripeTextUtils.nullIfBlank(builder.fingerprint);
    this.funding = asFundingType(builder.funding); = StripeTextUtils.nullIfBlank(;
    this.currency = StripeTextUtils.nullIfBlank(builder.currency);
    this.customerId = StripeTextUtils.nullIfBlank(builder.customer);
    this.cvcCheck = StripeTextUtils.nullIfBlank(builder.cvcCheck); = StripeTextUtils.nullIfBlank(;
    this.tokenizationMethod = StripeTextUtils.nullIfBlank(builder.tokenizationMethod);
    this.metadata = builder.metadata;

or you can use Builder method to it also has .name(@Nullable String name) method which you can use.

Recommended way is to use Card.Builder() and pass the arguments in the builder itself. Let me know if you need any help


currently you can workaround the below condition like this:

Card cardToSave = mCardInputWidget.getCard();
Card.Builder builder = new Card.Builder( String number, Integer expMonth, Integer expYear, String cvc); // pass the arguments here
Card newCard =;
// use this **newCard** for payment