GiniBusiness is the main class for interacting with Gini Pay Business SDK. It provides a way to submit a document for reviewing its extracted payment details and let’s the user make the payment with one of the payment providers.

The recommended flow is to:
  1. Call GiniBusiness.checkRequirements() to make sure that the flow can be completed.
  2. Call one of the overloads of setDocumentForReview, to submit a document.
  3. Display ReviewFragment.

Checking requirements

Requirements are not enforced, but recommended. Review Fragment will still start, but the flow cannot be completed if not all requirements are met.

checkRequirements() returns a list of missing requirements. Empty list means all requirements are met.

Setting a document for review

setDocumentForReview can be called with:
  1. Document instance in the case the upload was performed with Gini Pay Api lib (see Gini class).
  2. Document id, this will probably be the case when there’s backend integration between the Business Client and Gini.

When calling it with an id the SDK will make a network call to obtain a Document instance. So it is preferred to use the Document instance if you already have it. The same applies to the optional PaymentDetails, if they are present they will be displayed and network calls to get extractions will be skipped.

The exposed flows of GiniBussines are used by the ReviewFragment to observe the state of the document and extractions, but they are public so that they can be observed anywhere, the main purpose for this is to observe errors.

Note: If you observe payment details flow, you can check PaymentDetails.isPayable as an extra condition before displaying the ReviewFragment.

Display ReviewFragment

ReviewFragment displays document pages and extractions and it lets the user pay using a payment provider

To instantiate it you need to create a FragmentFactory and set it to fragment manager:

class ReviewFragmentFactory(private val giniBusiness: GiniBusiness) : FragmentFactory() {
    override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
        return ReviewFragment(giniBusiness)

supportFragmentManager.fragmentFactory = ReviewFragmentFactory(giniBusiness)

ReviewFragment handles errors by default, displaying snackbars for errors, but it can be configured to ignore them, in which case all flows of GiniBusiness should be observed for errors.