SDK Android

Integration

import com.aplazame.sdk.AplazameSDK;

String accessToken = "api_public_key";
Boolean sandbox = true;
AplazameSDK.setConfiguration(accessToken, sandbox);

Check availability

To display the payment button with Aplazame based on the limits set in your account

Double amount = 120.50;
String currency = "EUR";

AplazameSDK.checkAvailability(amount, currency, new AvailabilityCallback() {
  @Override
  public void onAvailable() {
    // Aplazame is available for this credit
  }

  @Override
  public void onNotAvailable() {
    // Aplazame is not available for this credit. You should not display Aplazame as an available payment method
  }

  @Override
  public void onFailure() {
    // An error has occurred
  }
});
Parameter Type Required Description
selector css selector no CSS selector to display/hide Aplazame’s payment method.
amount decimal yes Quantity to be financed.
currency ISO 4217 yes The currency code of the order.

Initiating the checkout

Here you can see how to integrate the SDK

AplazameSDK.setCheckout("checkout id");

Once you have defined the checkout ID, the checkout will start along with the callbacks for the result described in the next section.

Show result

WebView webView = findViewById(R.id.webview);
AplazameSDK.initializeAplazameWebView(webView, new JsWebViewEvents() {
  @Override
  public void onReadyEvent() {
    // La aplicación JS ha iniciado
    webView.setVisibility(View.VISIBLE);
  }

  @Override
  public void onStatusChangeEvent(String status) {
    switch (status) {
      case SUCCESS:
      break;
      case PENDING:
      break;
      case KO:
      break;
    }
  }

  @Override
  public void onCloseEvent(String status) {
    switch (status) {
      case SUCCESS:
      break;
      case PENDING:
      break;
      case DISMISS:
      break;
      case KO:
      break;
    }
  }
});

You can find more detailed information at https://github.com/aplazame/android-sdk/