Untitled

mail@pastecode.io avatar
unknown
dart
a month ago
2.6 kB
5
Indexable
Never
change the code as below:

1.code update
path:android->app->src->main->AndroidManifest.xml
->update below DropInActivity code in manifest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  <activity
            android:name="com.braintreepayments.api.DropInActivity"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="com.example.flutterbraintreeexample.braintree" />
            </intent-filter>
        </activity>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.code update
path:lib->app->screens->payment_screen.dart
->update payPalPayment() function code 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
->update below DropInActivity code in manifest
 void payPalPayment() async {
    print("===================>>>${userStore.currencySymbol.toUpperCase()}");

    appStore.setLoading(true);
    // final request = await BraintreePayPalRequest(amount: widget.mSubscriptionModel?.price.toString(), currencyCode: userStore.currencySymbol.toUpperCase(), displayName: userStore.username.validate());
    // final request = await BraintreePayPalRequest(amount: widget.mSubscriptionModel?.price.toString(), currencyCode: "USD", displayName: userStore.username.validate());

    var request = BraintreeDropInRequest(
      tokenizationKey: payPalTokenizationKey ?? "",
      collectDeviceData: true,
      vaultManagerEnabled: true,
      requestThreeDSecureVerification: true,
      /*email: "test@email.com",
      billingAddress: BraintreeBillingAddress(
        givenName: "Jill",
        surname: "Doe",
        phoneNumber: "5551234567",
        streetAddress: "555 Smith St",
        extendedAddress: "#2",
        locality: "Chicago",
        region: "IL",
        postalCode: "12345",
        countryCodeAlpha2: "US",
      ),*/
      paypalRequest: BraintreePayPalRequest(amount: widget.mSubscriptionModel?.price.toString(), displayName: userStore.username.validate(), currencyCode: userStore.currencySymbol.toUpperCase()),
      cardEnabled: true,
    );

    final result = await BraintreeDropIn.start(request);

    if (result != null) {
      appStore.setLoading(false);
      paymentConfirm();
    } else {
      appStore.setLoading(false);
    }
  }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Leave a Comment