You can use Braintree Payment Action to let users process a payment inside your app using a Credit Card, PayPal, Google Pay, or Apple Pay.
Before you start defining the Braintree Payment Action, you'll need to complete the Payment Setup on FlutterFlow. Follow the steps present on this page.
Let's build a simple checkout page for purchasing a product.
- 1.Click Add page, present on the Tool Bar. There are a number of e-commerce templates you can use to build your Payment UI.
- 2.Enter a name for the new page (eg. PaymentPage) and use any checkout template from the E-commerce section (you can modify this template as per your app's requirement or design the entire checkout page by selecting Blank Page).
- 3.Select the checkout button (you can modify the button as per your requirement).
Now, you are ready to define the Action to process payments.
Go to your project page on FlutterFlow and follow the steps below to define a Braintree Payment Action to any widget.
- 1.Select the widget on which you want to apply the Action.
- 3.Click + Add Action button.
- 4.Choose a gesture from the dropdown among On Tap, On Double Tap, or On Long Press.
- 5.Select the Action Type as Braintree Payment.
- 6.Enter the Amount either by defining a Specific Value or From Variable.
- 7.Under Payment Method, you can select among Credit Card, PayPal, or Drop-In. The Drop-In option lets users choose which payment method to use. If you want to use the Credit Card option follow the steps here.
- 8.If you have chosen the Drop-In option, select the Allowed Payment Types. Using Google Pay or Apple Pay will require you to have their respective Merchant ID defined during the Payment Setup process.
- 9.Enter the Currency Code and you can define the optional parameters like Tax Rate Percentage and Shipping Cost. Enabling Apple Pay requires you to specify the Country Code in the respective field.
Make sure the user is authenticated before triggering the Braintree Payment Action, otherwise it would result in an error. You can follow the steps on this page to set up Authentication.
If you want to keep only the Credit Card option on your checkout page, you'll need to add the CreditCardFrom widget to the page. Follow the steps below:
- 1.Select the Payment Method as Credit Card.
- 3.You can modify the design of the form widget as per your app's needs.
- 4.Again select the checkout button to complete defining the Action.
- 5.Enter the Currency Code and you can define the optional attributes like Tax Rate Percentage and Shipping Cost.
To run and test your app with payments, you have to download the app code (by going to Developer Menu > Download Code) and run it locally. Alternatively, you can generate an APK by clicking on the Build APK button present on the Tool Bar. Install the APK on your Android device to test the app.