In order to use the PayPal flow your application must be set up for App Links.
Before using this feature, you must register your App Link domain in the Braintree Control Panel:
- Log into your Control Panel (e.g. Sandbox, or Production).
- Click on the gear icon in the top right corner. A drop-down menu will open.
- Select Account Settings from the drop-down menu.
- In the Processing Options tab, go to Payment Methods section.
- Next to PayPal, click the Link Sandbox link. This will give you option to link your Braintree and PayPal accounts.
- If your accounts are already linked, you'd see an Options button instead.
- Click the View Domain Names button. This will take you to the PayPal Domain Names page.
- Note: If you have a single PayPal account, it will be at the bottom of the page. If you have multiple PayPal accounts, it will be at the top right of the page.
- Click the + Add link on the top right of the page or scroll to the Specify Your Domain Names section.
- In the text box enter your list of domain names separated by commas.
- Note: The value you enter must match your fully qualified domain name exactly – including the "www." if applicable.
- Click the Add Domain Names button.
- If the domain registration was successful for all the domain names listed in the text box, a banner will display the text "Successfully added domains". The registered domain names will be displayed in alphabetical order under the + Add button.
- If the registration was not successful for any of the domain names listed in the text box, a banner will display a list of domain names that failed qualified domain name validation along with their reasons for rejection. Any domain names that were successfully registered will be displayed in alphabetical order under the + Add button.
- Note: You can re-enter the rejected domain names in the text area with the corrections applied.
Pass your App Link to the PayPalClient
constructor:
val payPalClient = PayPalClient(
this,
"<#CLIENT_AUTHORIZATION#>",
Uri.parse("https://demo-app.com/braintree-payments") // Merchant App Link
)