Payment services setup

This project uses Stripe for card payments and Paypal Braintree for Paypal payments, backend code  is written in PHP. Follow the steps bellow to have your payment services backend up and running.

  1. Paypal (Braintree).
    1. Log in to your sandbox Braintree account.
    2. From the top right menu, expand the node and click “API”.
    3. Click Generate New Api Key if the list of API Keys is empty.
    4. Open payment-service project -> Navigate inside “paypal” folder -> Open “config.ini” and add the credentials found in the screen you generated your credentials in previous step.
  2. Stripe
    1. Log in to your Stripe account.
    2. From the left side menu click “Developers” -> “API keys”. If key list is empty, generate a
      Publishable key and a Secret key.
    3. Open payment-service project -> Navigate inside “stripe” folder -> Open “config.ini” and add your stripe api keys from previous step.
  3. Authorization. Follow the instructions here (only the first section) to generate the required .json file.
    1. Drop the generated .json file in payment-services/authentication folder.
    2. Open payment-services/authentication/auth.php and replace in this line your generated file name.
      $factory = (new Factory)->withServiceAccount(__DIR__.'/YOUR_FIREBASE_ADMIN_SDK_FILE.json');
  4. Installation. Navigate to each of the folders in payment-service project and run composer install command. If your hosting provider allows, you can run this command after you have uploaded your project (see next step).
  5. Hosting. Find a hosting provider and upload payment-services folder to the relevant directory.
  6. Open real estate mobile app project
    1. Open env.production
    2. Replace BASE_BACKEND_URL=YOUR_BASE_BACKEND_URL  with the base url of the host you uploaded payment-service project (eg. BASE_BACKEND_URL=https://mydomain.com)
    3. iOS: Register a URL scheme in Xcode (must always start with your Bundle Identifier and end in .payments – e.g. your.app.id.payments).
    4. Android: Open node_modules/react-native-paypal/android/src/main/AndroidManifest.xml and in the ‘activity’ tag add android:exported="true". This is to comply with latest Android release requirements. Android 31 is released but the developers of react-native-paypal haven’t yet released an update or patch so the previous change has to be made in node_modules package directly. It is off course not the recommended way to do it but it’s the only alternative up to now. After they release a fix we will update the app immediately.

Please note that the instructions above are for sandbox (testing) credentials. When you go live you will have to generate production credentials and replace in the “config.ini” files accordingly.