Simple Marketplace setup with PayPal

How to build a simple Marketplace payments integration

Overview

If your app needs to manage payments from one user to another, you can use the Paypal marketplace or Square services, but there is a simpler approach that can help you create the feature without the hassles of those methods.
We will be using PayPal to build the integration. This will allow us to take advantage of its extensive international support with more than 200 countries/regions and 25 currencies.
This integration allows us to enable payments between users quickly and easily. It can be useful for simpler applications or MVPs.
Please note that the app owner needs to be comfortable with any legal/logistical implications of having money routed through the app owner Paypal account vs. being a "true" marketplace payment (directly from buyer to seller).

Integration diagrams

This will be the high-level diagram of the integration:
At a low-level, this is how we do it:

Building the integration

You can review and test the integration in the following Bubble app (read-only).
  1. 1.
    Create a PayPal Developer account if you don't already have one:
  2. 2.
    Leave the Return URL as is. Check at least 'Accept payments' and 'Payouts'.
  3. 3.
    Create a PayPal REST API application in your account or in the client's.
  4. 4.
    Install the Paypal Checkout plugin in your Bubble app.
    1. 1.
      Add your keys into the plugin fields.
  5. 5.
    Copy the 'PayPal - Payouts API' calls from the sample app and paste them in your app API Connector plugin.
    1. 1.
      Add your PayPal client id and secret id to the API calls as username/password
  6. 6.
    Add the 'PayPal Button' from the 'Paypal Checkout' plugin and fill in all the data in it.
  7. 7.
    Add the workflow to capture the payment and its subsequent actions (in the sample app we display the final info retrieved from PayPal but you'll need to save it to the database in the appropriate data type).
Capture a payment
More info on PayPal Checkout.