4
votes

I'm developing an Android application for Property rental Management where Tenant will be able pay Rent directly to Landlord . I would like to use Braintree as it supports Credit/Debit cards , PayPal & Google Pay.

What I have tried so far ,

  1. I already have tried creating sandbox account of Braintree & performed simple payment transfer to single merchant.
  2. Explored Stripe Connect but looks time consuming documentation.
  3. Also explored Braintree Direct but it shows documentation same as single merchant payment transfer. I've followed steps mentioned & it lead me to implementation of single merchant payment transfer.

My questions:

  1. How a user can send payment directly to another user using Braintree either through Android SDK or PHP sdk on server ?
  2. Do I need Business account of Braintree to implement above service?
  3. Can you recommend any example regarding buyer to seller payment integration regardless of any programming language but using Braintree / Paypal ?
  4. Here is server code to process Payment according to documentation:

    $result=Braintree_Transaction::sale([
        'amount'=>$amount,
        'paymentMethodNonce'=>$nonce,
        'options'=> [
            'submitForSettlement'=>True
            ]
        ]);
    
  5. I'm open to Any other solutions if it fits my needs with example or reference document.

So , is there any parameter to supply through which we can transfer payment to receiver directly?

I know there are lots of questions above but I'm really confused as there is no proper documentation on android app & not found proper example to integrate.

Any guidance would be helpful.

3
Okay , updated my question . Now , how to use braintree to process rent payment from tenant to landlord directly ?Deep Shah
If you are asking "How do I avoid creating a merchant account" it sounds like you need a "gateway-only integration" from articles.braintreepayments.com/get-started/… and will need to contact Braintree directly. Otherwise you should explain in more detail how developers.braintreepayments.com/start/hello-client/android/v2 isn't appropriate. Or link to the PayPal or Braintree documentation you are referencing.Morrison Chang
@MorrisonChang , I've updated my question description with links of document which I've referred & exactly what I need with Braintree.Deep Shah
@MorrisonChang my main concern is there is not single landlord nor single tenant so , Does Braintree Direct supports this kind of facility where any user can send payment to any other user directly ?Deep Shah
Did take me a while to find and the keywords to use is 'payout provider' for sending money to landlord(s). Looks like payments/payouts uses a different API, so you should contact Braintree about Hyperwallet and/or investigate Hyperwallet yourself and check their developer documentationMorrison Chang

3 Answers

0
votes

This is a proper documentation for implementing braintree. Check this out -

https://developers.braintreepayments.com/guides/drop-in/setup-and-integration/android/v2

In your gradle add this -

dependencies {
  implementation 'com.braintreepayments.api:drop-in:3.7.1'
}

Call this in your payment button -

public void onBraintreeSubmit(View v) {
  DropInRequest dropInRequest = new DropInRequest().clientToken(clientToken);
  startActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
}

You will get a nonce in your Activity's onActivtyResult -

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == REQUEST_CODE) {
    if (resultCode == RESULT_OK) {
      // use the result to update your UI and send the payment method nonce to your server
      DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
    } else if (resultCode == RESULT_CANCELED) {
      // the user canceled
    } else {
      // handle errors here, an exception may be available in
      Exception error = (Exception) data.getSerializableExtra(DropInActivity.EXTRA_ERROR);
    }
  }
}

Then if you are not using cards, you call configure different payment methods like Google Pay, etc.

Hope it helps.

0
votes
public void getpaymentstatus(final Context context,String token,String user_id,String ride_id)
{
    ApiServiceInterface service=getApiInstance(context);
    try {
        service.Passengerpaymentstatus(token,user_id,ride_id)
                .enqueue(new Callback<PaymentStatus>() {
                    @Override
                    public void onResponse(Call<PaymentStatus> call, Response<PaymentStatus> response) {
                        if (response.isSuccessful())
                        {
                            if (response!=null)
                            {
                                try {
                                    PaymentStatus paymentStatus=response.body();
                                    passengerPaymentStatus.Passengerpaymentstatusclass(paymentStatus);
                                }catch (Exception e)
                                {
                                    e.printStackTrace();
                                }
                            }
                        }
                    }

                    @Override
                    public void onFailure(Call<PaymentStatus> call, Throwable t)
                    {
                        String message=context.getResources().getString(R.string.error_message);
                        PopupHelper.displayAlertDialog(context, message);
                        t.printStackTrace();
                    }
                });
    }catch (Exception e)
    {
        e.printStackTrace();
    }
}
0
votes
private ApiServiceInterface getApiInstance(Context context) {
    HttpLoggingInterceptor logInter = new HttpLoggingInterceptor();
    logInter.setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient mIntercepter = new OkHttpClient.Builder()
            .addInterceptor(logInter)
            .build();
    String BASE_URL = "http://192.168.0.14:80/api/auth/";
     Retrofit retrofitInstance = new Retrofit.Builder()
            //.addConverterFactory(new NullOnEmptyConverterFactory())
            .addConverterFactory(GsonConverterFactory.create())
            .baseUrl(BASE_URL)
            .client(mIntercepter)
            .build();
    return retrofitInstance.create(ApiServiceInterface.class);
}