Local Payment Methods

Client-Side Implementationanchor

important

The SSL certificates for all Braintree SDKs are set to expire by June 30, 2025. This will impact existing versions of the SDK in published versions of your app. To reduce the impact, upgrade the Android SDK to version 4.45.0+ or version 5.0.0+ for the new SSL certifications.

If you do not decommission your app versions that include the older SDK versions or force upgrade your app with the updated certificates by the expiration date, 100% of your customer traffic will fail.

Setupanchor

In order to add Local Payment Methods to your Android application, you must declare a URL scheme in your AndroidManifest.

Get the SDKanchor

Add the following in your app-level build.gradle:

  1. Kotlin
  2. Groovy
dependencies {
    implementation("com.braintreepayments.api:local-payment:4.49.1")
}

Determine which merchant account to useanchor

This will determine which PayPal credentials are used for the transaction, and must match the merchant account specified with any other calls in the transaction lifecycle (e.g. Transaction.sale). Many merchants use a separate merchant account for local payments. Other merchants use separate merchant accounts for transactions in different currencies. It is not possible to switch merchant accounts between the start and finish of a local payment transaction, so it is important to determine the correct one from the start.

Invoke payment flowanchor

You can implement a custom UI, such as your own iDEAL button.

The following is a list of valid paymentType, countryCodeAlpha2, and currencyCode values for each Local Payment Method:

Local Payment Method Payment type Country codes Currency codes
Bancontact bancontact BE EUR
BLIK blik PL PLN
EPS eps AT EUR
grabpay grabpay SG SGD
iDEAL ideal NL EUR
Klarna Pay Now / SOFORT sofort AT, BE, DE, IT, NL, ES, GB EUR (outside GB), GBP (GB only)
MyBank mybank IT EUR
Pay Upon Invoice pay_upon_invoice DE EUR
P24 p24 PL EUR, PLN

The paymentTypeCountryCode parameter is only required for payment methods with multiple potential country codes. If a paymentTypeCountryCode is not provided, then the countryCode value will be used as the paymentTypeCountryCode.

The following is a list of required parameters for each Local Payment Method, as well as any applicable transaction limits:

Local Payment Method Required parameters Customer transaction limits
Bancontact givenName, surname, currencyCode Min: 1.00 EUR
BLIK givenName, surname, currencyCode, email Min: 1.00 PLN
EPS givenName, surname, currencyCode Min: 1.00 EUR
grabpay givenName, surname, currencyCode Min: 1.00 SGD
iDEAL givenName, surname, currencyCode N/A
Klarna Pay Now / SOFORT givenName, surname, currencyCode, countryCodeAlpha2, paymentTypeCountryCode Min: 1.00 EUR (outside the United Kingdom), 1.00 GBP (United Kingdom only)
MyBank givenName, surname, currencyCode, address, email, billingAddress, birthDate, phone, phoneCountryCode N/A
Pay Upon Invoice givenName, surname, currencyCode N/A
P24 givenName, surname, currencyCode, email Min: 1.00 PLN

The following is a list of business identification numbers (bic) you can optionally include to identify the specific bank when processing iDEAL as a payment payment method:

Bank BIC
Rabobank RABONL2U
ABN AMRO ABNANL2A
Van Lanschot Bankiers FVLBNL22
Triodos Bank TRIONL2U
ING Bank INGBNL2A
SNS Bank SNSBNL2A
ASN ASNBNL21
RegioBank RBRBNL21
Knab KNABNL2H
Bunq BUNQNL2A
Yoursafe BITSNL2A
note

Note: bic can only be included for iDEAL payment methods. If you are processing a payment method other than iDEAL you do not need to include a bic.

Next, create a BraintreeClient with a ClientTokenProvider or Tokenization Key. Instantiate a LocalPaymentClient to start the payment flow and implement a LocalPaymentListener to receive results.

  1. Java
  2. Kotlin
class MyActivity extends FragmentActivity implements LocalPaymentListener {

  private BraintreeClient braintreeClient;
  private LocalPaymentClient localPaymentClient;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    braintreeClient = new BraintreeClient(this, new ExampleClientTokenProvider());
    localPaymentClient = new LocalPaymentClient(this, braintreeClient);
    localPaymentClient.setListener(this);
  }

  private void startLocalPayment() {
    PostalAddress address = new PostalAddress();
    address.setStreetAddress("836486 of 22321 Park Lake");
    address.setCountryCodeAlpha2("NL");
    address.setLocality("Den Haag");
    address.setPostalCode("2585 GJ");

    LocalPaymentRequest request = new LocalPaymentRequest();
    request.setPaymentType("ideal");
    request.setAmount("1.01");
    request.setAddress(address);
    request.setPhone("639847934");
    request.setEmail("joe@getbraintree.com");
    request.setGivenName("Jon");
    request.setSurname("Doe");
    request.setShippingAddressRequired(true);
    request.setCurrencyCode("EUR");

    localPaymentClient.startPayment(request, (result, error) -> {
      // do any preprocessing result.getPaymentId()
      localPaymentClient.approvePayment(MyActivity.this, result);
    });
  }

  @Override
  public void onLocalPaymentSuccess(@NonNull LocalPaymentNonce localPaymentNonce) {
      // send localPaymentNonce.getString() to server
  }

  @Override
  public void onLocalPaymentFailure(@NonNull Exception error) {
    if (error instanceof UserCanceledException) {
      // user canceled
    } else {        
      // handle error
    }
  }
}

If you are using using an Activity and your Activity's launch mode is singleTop, singleTask, or singleInstance you will also need to override onNewIntent:

  1. Java
  2. Kotlin
class MyActivity extends FragmentActivity {

  @Override
  protected void onNewIntent(Intent newIntent) {
    super.onNewIntent(newIntent);

    setIntent(newIntent);
  }
}
important

You must implement Braintree webhooks in order to accept Local Payment Methods. See Server-side for details.

Shipping addressesanchor

If you need a shipping address to ship physical goods, set shippingAddressRequired to true on your LocalPaymentRequest. This setting will prompt your customer to provide shipping details. If you have already collected these details from your customer, you can pass the shipping details within LocalPaymentRequest to avoid having your customer provide them again.

If you are not shipping physical goods, then use the default value of false for shippingAddressRequired. This setting will prompt your customer to provide just the basic information like givenName, surname, phone, and email. If you have already collected these details from your customer, you can pass them on LocalPaymentRequest to avoid having your customer provide them again.


Next Page: Server-side