capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 74 forks source link

Android Google pay issue #188

Closed mostafa3ly closed 1 year ago

mostafa3ly commented 2 years ago

``Platform

Google pay is not working on android the isGooglePayAvailable function is always return false and throw error "Not implemented in device" unless my device is using google pay in all other apps and present google play is throw an error make the app to crash. i tried to find the issue but i can't find the reason of this. i think may be this issue cause of the version of stripe 17.2.1 and the latest version is 25.2.0.

MainActivity.java


 import android.os.Bundle;
 import com.getcapacitor.BridgeActivity;

 public class MainActivity extends BridgeActivity {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         registerPlugin(com.getcapacitor.community.stripe.StripePlugin.class);
     }
 }

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app">

    <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">

        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:name="com.example.app.MainActivity" android:label="@string/title_activity_main" android:theme="@style/AppTheme.NoActionBarLaunch" android:launchMode="singleTask">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
        </provider>

        <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" />

        <meta-data android:name="com.getcapacitor.community.stripe.enable_google_pay" android:value="@bool/enable_google_pay" />

        <meta-data android:name="com.getcapacitor.community.stripe.publishable_key" android:value="@string/publishable_key" />

        <meta-data android:name="com.getcapacitor.community.stripe.country_code" android:value="@string/country_code" />

        <meta-data android:name="com.getcapacitor.community.stripe.merchant_display_name" android:value="@string/merchant_display_name" />

        <meta-data android:name="com.getcapacitor.community.stripe.google_pay_is_testing" android:value="@bool/google_pay_is_testing" />

    </application>

    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

strings.xml

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">App</string>
    <string name="title_activity_main">App</string>
    <string name="package_name">com.example.app</string>
    <string name="custom_url_scheme">com.example.app</string>

    <string name="publishable_key">pk_test_API_KEY</string>
    <bool name="enable_google_pay">true</bool>
    <string name="country_code">AE</string>
    <string name="merchant_display_name">App</string>
    <bool name="google_pay_is_testing">true</bool>

</resources>
rdlabo commented 2 years ago

@mostafa3ly Thanks for issue. Demo code is fine for me. Can you try this?: https://github.com/capacitor-community/stripe/tree/master/demo/angular

isGooglePayAvailable method is simple method. This checked by stripe GooglePayLauncher method. https://github.com/capacitor-community/stripe/blob/master/android/src/main/java/com/getcapacitor/community/stripe/StripePlugin.java#L62

Thanks.

mostafa3ly commented 2 years ago

@rdlabo Please can you test demo code for android of React cause i clone it and generate android app and the issue is still appear on your demo code

rdlabo commented 1 year ago

You created https://github.com/capacitor-community/stripe/issues/190 , so this issue will be close. Thanks.