This project allows to integrate the wallee payment service into Android apps.
To start using wallee API you will have to add a dependency to your project's build file:
The simplest way to use the SDK is using the
ActivityAwarePaymentFragment. This fragment manages
the whole payment process. In essence the
Activity has to implement the interfaces
FragmentTerminationListener. This fragment fetches the required
data automatically from the
FragmentTerminationListener is responsible for handling the termination of the fragment. The
fragment terminates when either the payment process was successful or it failed.
CredentialsProviderResolver is responsible for fetching the access credentials to the web
service API. The access user ID and the HMAC key of the user need to be stored securely on the
merchant backend server. They cannot be stored within the application. The backend server can
request for a particular transaction temporary credentials which grants temporary access to the
transaction. Those credentials can be forwarded to the app. This way the merchant keeps control
over what the user of the app is allowed to do.
ActivityAwarePaymentFragment has generally the following flow:
- Allow the user to select a token from a list of tokens.
- When the user wants to use another payment method or if there are not tokens stored for the user a list of payment methods is presented.
- When the user selects a payment method the form for collecting the data (like credit card number) is loaded.
- The form is submitted and the transaction is processed.
This flow can be adapted see the advanced usage section for more information about this.
To run the sample application the easiest way is to checkout the repository and to launch the
sample app through
sample app shows how to use the
ActivityAwarePaymentFragment. This is the simplest way to
use the SDK.
To see how to use the
ActivityAwarePaymentFragment the best is to take a look at the sample app.
The SDK is build in layers:
- Credentials Handling: This layer is responsible to provide and manage the credentials.
- API Request Handling: The API request handling allows to interact with the web service API. This layer requires the credentials.
- Various Views: There are different views for each of the used screens.
- Flow Coordinator: The flow coordinator binds the API request handling and the views layer together. The flow coordinator implies a specific flow as described above.
- Fragments: The fragments we provide simplifies the usage of the flow coordinator.
Each of the above layers can be used as pleased. This implies that an app can use only the web services and implements the rest by itself or it can also use the different views, but with a different flow.
For detailed information about wallee API please see wallee documentation.