The "PayPal Extension By @Black_Knight " is your entry point for incorporating PayPal's strength into your App Inventor applications. With the help of this dynamic plugin, the PayPal API may be easily accessed by your apps. Its clever construction makes it simple to retrieve access tokens using client credentials, bringing up a plethora of options for creating payment features.
Step 1: Set Up Your Project
- Open MIT App Inventor and create a new project or open an existing one.
Step 2: Add Components
- Drag and drop a "WebViewer" component from the "User Interface" section onto your screen.
- Drag and drop the "Paypal" extension component onto the screen.
Step 3: Design Your User Interface
- Arrange your components on the screen as you wish. You might want to add buttons or labels for user interaction.
Step 4: Blocks Setup
- In the Blocks section, set up the logic to interact with the PayPal API using the extension and Web Viewer.
- Set the
ClientSecretproperties of the PayPal extension.
- When the user performs an action (e.g., clicking a button), call the
GetAccessTokenfunction of the PayPal extension to obtain an access token.
- In the
AccessTokenObtainedevent, call the
MakePayPalPaymentfunction to initiate a payment and obtain the payment link (href).
- In the
PaymentInfoObtainedevent, parse the response and use the
ExtractHrefFromLinksfunction to get the payment link.
- Load the extracted payment link into the Web Viewer using the
Go to URLblock.
Step 5: Handle Web Viewer Page Loaded and Redirect URLs
- Use the Web Viewer's
PageLoadedevent to detect when the PayPal payment page has loaded.
- In the
PageLoadedevent, check the URL of the Web Viewer. If the URL matches the "cancel_url," it indicates a cancelled payment.
- If the URL matches the "return_url," it indicates a successful payment. You can show a success message to the user in this case.
- after successful payment you have to use the
capture_amountblock to capture your price
steps in one image :
Thanks to @Ruben_Pietrobelli who tested this Extension and confirm that is working fine with him
successful payment in live mode
You can buy it via PayPal it costs 12$ after your payment you will directed to the download URL of the Extension.
© 2023 MrKoder. All rights reserved.
For inquiries, please contact: Mr koder
Visit our YouTube channel: Mr Koder's YouTube Channel