User Credit Info (optional)
This 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.OnCreditInfoCompleteListener { void onComplete(CreditInfo creditInfo) { // amounts in paise long creditTaken = creditInfo.getCreditTaken(); long creditLimit = creditInfo.getCreditLimit(); }});
Your Android App
// callback methodCreditAccessManager.getUserCreditInfo(this, object: CreditAccessManager.OnCreditInfoCompleteListener { override fun onComplete(creditInfo: CreditInfo) { // amounts in paise val creditTaken = creditInfo.creditTaken val creditLimit = creditInfo.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