User Credit Info
#
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 BharatXTransactionManager from '@bharatx/startup-sdk-reactnative';
BharatXTransactionManager.getUserCreditInfo((result) => { const creditTaken = result.creditTaken const creditLimit = result.creditLimit});
Flutter App
import 'package:startup_sdk_flutter/startup_sdk_flutter.dart';
var creditInfo = await BharatXTransactionManager.getUserCreditInfo();// amounts in paisevar creditTaken = creditInfo.creditTaken;var creditLimit = creditInfo.creditLimit;
- Request
- Response
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}
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
React Native App
import BharatXTransactionManager from '@bharatx/startup-sdk-reactnative';
BharatXTransactionManager.getUserCreditInfoFull((result) => { const creditTaken = result.creditTaken const creditLimit = result.creditLimit const totalOutstandingAmount = result.totalOutstandingAmount const dueAmount = result.dueAmount const currentCycleDueDate = result.currentCycleDueDate const repaymentLink = result.repaymentLink});
Flutter App
import 'package:startup_sdk_flutter/startup_sdk_flutter.dart';
var creditInfoFull = await BharatXTransactionManager.getUserCreditInfoFull();// amounts in paisevar creditTaken = creditInfoFull.creditTaken;var creditLimit = creditInfoFull.creditLimit;var totalOutstandingAmount = creditInfoFull.totalOutstandingAmountvar dueAmount = creditInfoFull.dueAmountvar currentCycleDueDate = creditInfoFull.currentCycleDueDatevar repaymentLink = creditInfoFull.repaymentLink
This is not available via API call yet.