diff --git a/stripe/src/main/java/com/stripe/android/model/PaymentMethodCreateParams.kt b/stripe/src/main/java/com/stripe/android/model/PaymentMethodCreateParams.kt index 393fabf24a0..ec1642c6d43 100644 --- a/stripe/src/main/java/com/stripe/android/model/PaymentMethodCreateParams.kt +++ b/stripe/src/main/java/com/stripe/android/model/PaymentMethodCreateParams.kt @@ -599,10 +599,14 @@ data class PaymentMethodCreateParams internal constructor( @JvmStatic fun createFromGooglePay(googlePayPaymentData: JSONObject): PaymentMethodCreateParams { val googlePayResult = GooglePayResult.fromJson(googlePayPaymentData) - val tokenId = requireNotNull(googlePayResult.token?.id) + val token = googlePayResult.token + val tokenId = token?.id.orEmpty() return create( - Card.create(tokenId), + Card( + token = tokenId, + attribution = setOfNotNull(token?.card?.tokenizationMethod?.toString()) + ), PaymentMethod.BillingDetails( address = googlePayResult.address, name = googlePayResult.name, diff --git a/stripe/src/test/java/com/stripe/android/model/PaymentMethodCreateParamsTest.kt b/stripe/src/test/java/com/stripe/android/model/PaymentMethodCreateParamsTest.kt index fc85d2f3bb7..fa1120a2de8 100644 --- a/stripe/src/test/java/com/stripe/android/model/PaymentMethodCreateParamsTest.kt +++ b/stripe/src/test/java/com/stripe/android/model/PaymentMethodCreateParamsTest.kt @@ -27,7 +27,10 @@ class PaymentMethodCreateParamsTest { GooglePayFixtures.GOOGLE_PAY_RESULT_WITH_NO_BILLING_ADDRESS) ).isEqualTo( PaymentMethodCreateParams.create( - PaymentMethodCreateParams.Card.create("tok_1F4ACMCRMbs6FrXf6fPqLnN7"), + PaymentMethodCreateParams.Card( + token = "tok_1F4ACMCRMbs6FrXf6fPqLnN7", + attribution = setOf("GooglePay") + ), PaymentMethod.BillingDetails.Builder() .build() ) @@ -41,7 +44,10 @@ class PaymentMethodCreateParamsTest { GooglePayFixtures.GOOGLE_PAY_RESULT_WITH_FULL_BILLING_ADDRESS) ).isEqualTo( PaymentMethodCreateParams.create( - PaymentMethodCreateParams.Card.create("tok_1F4VSjBbvEcIpqUbSsbEtBap"), + PaymentMethodCreateParams.Card( + token = "tok_1F4VSjBbvEcIpqUbSsbEtBap", + attribution = setOf("GooglePay") + ), PaymentMethod.BillingDetails( phone = "1-888-555-1234", email = "stripe@example.com",