Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding integrating both DropIn and Paypal as standlone option #415

Open
rohitgarg29 opened this issue Apr 25, 2023 · 6 comments
Open

Comments

@rohitgarg29
Copy link

Hi Team,

I want to add paypal option in both DropIn client and Paypal as standlone integration.

For Paypal Standlone, I have to add the following to my activity:

<activity
            android:name=".bookingflow.ordersummary.ReviewAndPayActivity"
            android:configChanges="orientation"
            android:exported="true"
            android:label="@string/order_summary_activity_label"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="${applicationId}.braintree" />

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

For DropIn, I will have to add the following:

<activity
            android:name="com.braintreepayments.api.DropInActivity"
            android:exported="true"
            tools:node="merge">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="${applicationId}.braintree" />

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

Because of this, when I am coming back from paypal, i have to choose from the picker, Is there a work around or way to resolve it?

@sshropshire
Copy link
Contributor

Hi @rohitgarg29 thanks for using the Braintree SDK for Android. We do have a constructor for BraintreeClient that allows you to specify a custom return url. In the AndroidManifest.xml for your standalone integration, you can then specify a custom url scheme instead of using the applicationId manifest placeholder.

@rohitgarg29
Copy link
Author

rohitgarg29 commented Apr 25, 2023

Hi @sshropshire Thanks for replying. I tried your way but getting the error message "Paypal is not enabled" in onPayPalFailure method and it does not even launch the paypal payment UI.

braintreeClient = new BraintreeClient(requireContext(), clientTokenResponse.getClientTokenData().getClientToken(), "myapp");
        payPalClient = new PayPalClient(this, braintreeClient);
        payPalClient.setListener(this);
        PayPalCheckoutRequest request = new PayPalCheckoutRequest(getAmount());
        request.setCurrencyCode(PAYPAL_CURRENCY_CODE);
        paypalContainer.setVisibility(GONE);
        payPalClient.tokenizePayPalAccount(requireActivity(), request);

@sshropshire
Copy link
Contributor

@rohitgarg29 have you followed this guide to enable PayPal as a payment source?

@rohitgarg29
Copy link
Author

@sshropshire yes it is enabled. Without drop-in it was working fine.

@sshropshire
Copy link
Contributor

@rohitgarg29 does your manifest for for the ReviewAndPayActivity now contain:

<data android:scheme="myapp" />

?

@rohitgarg29
Copy link
Author

@sshropshire it has this value as well. Can you please test it at your end with drop and standlone both options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants