You can accept payments in your app using Braintree integration. This will also allow your users to pay directly using a credit card or using a service like PayPal, Google Pay, or Apple Pay.
Integrating the Braintree in your app comprises the following steps:
You should always test your payment processing using a Sandboxed environment, before deploying them to a production environment.
Follow the steps below to set up using Braintree:
- Sign up for getting access to the Sandboxed environment. You might receive an email with the additional steps for completing the sign-up process. If you already have a Braintree account just Log In.
- Navigate to the Project Settings page and click on Braintree.
- On this section, Enable Payments using the toggle.
- Enable Use sandbox mode to try the test environment.
- Under the Sandbox section, you need to enter the Merchant ID, Tokenization Key, Public Key & Private Key of the Braintree account.
- Navigate to your Braintree account Homepage, here, you'll get the Merchant ID, Public Key & Private Key.
- To generate a Tokenization Key, click the gear icon (top-right corner), select API.
- Click Generate New Tokenization Key.
- Copy the Key and enter it in the respective field of Teta.
Follow the steps below to set up using live environment:
- 1.Create the Braintree Account (Not sandbox) and get the production credentials.
- 2.Select the Settings page and click Braintree.
- 3.Add the production credentials under the Production section.
Now, you are ready to build and distribute your app with payments to production.
Under the Other Info, you need to specify the following:
- 1.Company Name (Required): Enter a name for the merchant (you) that the user will see while performing the payment.
- 2.Country Code (Required): Enter your country code.
- 3.Currency Code (Optional): Enter your country code.
You can use Braintree Payment Action to let users process a payment inside your app.
To add the Braintree in your project:
- Add within the Scaffold a State of type String.
- Select a Button from the tree area.
- Click on Actions + (on the right side of your screen).
- Click on Action dropdown.
- Find the Action Type dropdown and change it to Braintree.
- Select OnTap as the Gesture.
- Find the dropdown below and select Pay.
- Enter the Amount either by defining a Specific Value.
- Finally in the in the last dropdown select the state created in the scaffold.