Skip to content

felloh-org/android-sdk

Repository files navigation

Felloh Payment SDK for Android

CI

Embed Felloh payment forms in your Android application.

Installation

Add the JitPack repository to your project's settings.gradle:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency to your app's build.gradle:

dependencies {
    implementation 'com.github.felloh-org:android-sdk:1.0.0'
}

Prerequisites

Before using the SDK, you need to:

  1. Create an API key — Get your publishable key from the Felloh Dashboard.
  2. Create a booking — Use the Felloh API to create a booking.
  3. Create an ecommerce instance — Use the Felloh API to create an ecommerce instance for the booking. This must be done server-side using your private key.

Quick Start

// In your Activity or Fragment
FrameLayout container = findViewById(R.id.payment_container);

PaymentOptions options = new PaymentOptions()
    .setEnvironment(Environment.SANDBOX);

FellohPayments payments = new FellohPayments(container, "pk_live_...", options);

payments.setEventListener(new PaymentEventListener() {
    @Override
    public void onSuccess(TransactionData data) {
        Log.d("Payment", "Success: " + data.getTransactionId());
    }

    @Override
    public void onDecline(TransactionData data) {
        Log.d("Payment", "Declined: " + data.getTransactionId());
    }
});

payments.render("ecommerce-instance-uuid");

Constructor

FellohPayments(ViewGroup container, String publicKey)
FellohPayments(ViewGroup container, String publicKey, PaymentOptions options)
Parameter Type Description
container ViewGroup The view to embed the payment form in
publicKey String Your publishable API key from the Felloh Dashboard
options PaymentOptions Optional configuration (see below)

Options

PaymentOptions options = new PaymentOptions()
    .setEnvironment(Environment.SANDBOX)
    .setMoto(true)
    .setDesign(new PaymentDesign(false, true));
Method Type Default Description
setEnvironment() Environment Environment.PRODUCTION Payment environment
setMoto() boolean false Enable Mail Order/Telephone Order
setDesign() PaymentDesign PaymentDesign() Form appearance options

PaymentDesign

Parameter Type Default Description
payButton boolean true Show the built-in pay button
storeCard boolean true Show card storage option

Methods

render(ecommerceId)

Render the payment form for a given ecommerce instance.

payments.render("550e8400-e29b-41d4-a716-446655440000");

Throws IllegalArgumentException if the ecommerce ID is not a valid UUID.

pay()

Manually trigger payment processing. Use when the built-in pay button is hidden.

payments.pay();

getStatus()

Returns the current PaymentStatus: PRELOAD, RENDERED, PROCESSING, SUCCESS, or DECLINED.

destroy()

Remove the payment form and clean up resources. Call in your Activity/Fragment's onDestroy().

@Override
protected void onDestroy() {
    super.onDestroy();
    payments.destroy();
}

Events

Register a PaymentEventListener to receive payment lifecycle events:

payments.setEventListener(new PaymentEventListener() {
    @Override
    public void onRender() {
        // Payment form is ready
    }

    @Override
    public void onSuccess(TransactionData data) {
        // Payment succeeded
    }

    @Override
    public void onDecline(TransactionData data) {
        // Payment declined
    }

    @Override
    public void onProcessing(TransactionData data) {
        // Payment is being processed
    }
});

All callbacks receive a TransactionData object with getTransactionId().

Environments

Environment Description
Environment.PRODUCTION Live payments (default)
Environment.STAGING Staging environment for testing
Environment.SANDBOX Sandbox environment for testing

Requirements

  • Android API 21+ (Android 5.0 Lollipop)
  • Internet permission (added automatically by the SDK)

Links

License

MIT

About

Android SDK for Felloh Payments

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages