User Credit Info (optional)
#
Credit InfoThis is used in merchant check out screen (listing BharatX as an option) to display to the user how much credit they have obtained till now, and the total amount of credit they have access to:
- Java
- Kotlin
- React Native
- Flutter
- Server
Your Android App
CreditAccessManager.getUserCreditInfo(this, new CreditAccessManager.OnCompleteListener<CreditInfo>() { void onComplete(CreditInfo result) { // amounts in paise long creditTaken = result.getCreditTaken(); long creditLimit = result.getCreditLimit(); } });
Your Android App
// callback methodCreditAccessManager.getUserCreditInfo(this, object: CreditAccessManager.OnCompleteListener<CreditInfo> { override fun onComplete(result: CreditInfo) { // amounts in paise val creditTaken = result.creditTaken val creditLimit = result.creditLimit } })
// or if you are using Kotlin Coroutines/in a suspend functionval creditInfo = CreditAccessManager.getUserCreditInfo(this)// amounts in paiseval creditTaken = creditInfo.creditTakenval creditLimit = creditInfo.creditLimit
React Native App
import BharatXCommonUtilManager from '@bharatx/bharatx-reactnative-common';
// amounts in paiseBharatXCommonUtilManager.getUserCreditInfo((creditTaken, creditLimit) => { // ...});
Flutter App
import 'package:bharatx_flutter_common/bharatx_flutter_common.dart';
var creditInfo = await BharatXCommonUtilManager.userCreditInfo;// amounts in paisevar creditTaken = creditInfo.creditTaken;var creditLimit = creditInfo.creditLimit;
Your Server - Request
POST https://sdk.bharatx.tech/merchant/credit/userCreditInfo
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)X-Partnerid: partnerId
Body:{ // user identifier that you registered in the // "Registering your user identification" section "userId": string}
BharatX Server - Response
Headers:-
Body:{ // amounts in paise "creditLimit": number, "creditTaken": number, // if the user is registered with BharatX or not. If registered // is false, creditLimit and creditTaken will be 0. "registered": boolean}
Status = 200; SuccessStatus = 401; Authorization FailureStatus = 400; Bad RequestStatus = 500; Internal Server Error
#
Credit Info (Full)To know more about the user's credit history and to allow for recollections:
- Java
- Kotlin
- React Native
- Flutter
- Server
Your Android App
CreditAccessManager.getUserCreditInfo(this, new CreditAccessManager.OnCompleteListener<CreditInfoFull>() { void onComplete(CreditInfoFull result) { // amounts in paise long creditTaken = result.getCreditTaken(); long creditLimit = result.getCreditLimit(); long totalOutstandingAmount = result.getTotalOutstandingAmount(); long dueAmount = result.getDueAmount(); String currentCycleDueDate = result.getCurrentCycleDueDate(); String repaymentLink = result.getRepaymentLink(); } });
Your Android App
// callback methodCreditAccessManager.getUserCreditInfoFull(this, object: CreditAccessManager.OnCompleteListener<CreditInfoFull> { override fun onComplete(result: CreditInfoFull) { // amounts in paise val creditTaken = result.creditTaken val creditLimit = result.creditLimit val totalOutstandingAmount = result.totalOutstandingAmount val dueAmount = result.dueAmount val currentCycleDueDate = result.currentCycleDueDate val repaymentLink = result.repaymentLink } })
// or if you are using Kotlin Coroutines/in a suspend functionval creditInfoFull = CreditAccessManager.getUserCreditInfoFull(this)// amounts in paiseval creditTaken = creditInfoFull.creditTakenval creditLimit = creditInfoFull.creditLimitval totalOutstandingAmount = creditInfoFull.totalOutstandingAmountval dueAmount = creditInfoFull.dueAmountval currentCycleDueDate = creditInfoFull.currentCycleDueDateval repaymentLink = creditInfoFull.repaymentLink
This is not available in our React Native SDK yet.
This is not available in our Flutter SDK yet.
This is not available via API call yet.