Requesting a Payment
The following steps summarize an in-app payment request:
- 3rd party backend uses the Scan to Pay API to create a transaction code (which contains the amount, references, etc.).
- The 3rd party app invokes the intent passing in this newly created code.
- The Scan to Pay in-app library will facilitate the payment and return a result and reference indicating the payment status to the calling activity.
-
- The 3rd backend will then query the Scan to Pay system with the returned reference to guarantee the payment status. Alternatively, the 3rd backend will query itself to see if Scan to Pay has notified it of a new payment.
-
NoteIt is imperative that the 3rd party app does not trust the library's result as the final status. A backend API call must be done to verify the payment status.
Invoking the Payment Intent
The following snippet illustrates how to invoke the payment request Intent:
Intent intent = new Intent(context, LibLiteActivity.class);
intent.putExtra(LibLiteActivity.IN_CODE, "1234567890");
intent.putExtra(LibLiteActivity.IN_API_KEY, "APIKEY");
intent.putExtra(LibLiteActivity.IN_HASH, “HASH KEY");
intent.putExtra(LibLiteActivity.IN_SYSTEM, "LIVE"); context.startActivityForResult(intent, 10);Values passed to the LibLiteActivity
Name | Type | Description |
|---|---|---|
LibLiteActivity.IN_CODE | String | This is the code created by calling the Scan to Pay API representing the transaction. |
LibLiteActivity.IN_API_KEY | String | This is the API key provided by Oltio/UKheshe that will enable the library to be used. |
LibLiteActivity.IN_SYSTEM | String | This value can be “LIVE” or “TEST”, representing the |
LibLiteActivity.IN_HASH | String | This allows capability for the app to read the SMS for registration. |
LibLiteActivity.IN_SUGGESTED_MSISDN | String | This is an optional field if you know the clients |
Handling the Payment Response
The following snippet illustrates how to handle the response from the LibLiteActivity:
SHARDUL TO PROVIDE
protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) {
case 10:Name | Type | Description |
|---|---|---|
LibLiteActivity.LIBLITE_ERROR | Returned if an error has occurred before the payment | – This indicates the type of error that occurred. See the error table below LibLiteActivity.OUT_LOCATION
|
LibLiteActivity.LIBLITE_PAYMENT_SUCCESS | Returned on payment success | LibLiteActivity.OUT_TX_REFERENCE
|
LibLiteActivity.LIBLITE_PAYMENT_FAILED | Returned if the payment failed | LibLiteActivity.OUT_TX_REFERENCE
|
LibLiteActivity.LIBLITE_USER_CANCELLED | Returned if the user aborted the process | LibLiteActivity.OUT_LOCATION
|
LibLiteActivity.LIBLITE_INVALID_CODE | Returned if the code that was passed to the LibLiteActivity is invalid | None. |
Updated 20 days ago
