Skip to main content
Version: 3.2.0

Transaction Flow

Initiate a BharatX Transaction#

When the server clicks on BharatX payment option, your server must make a call to our server to initiate transaction:

POST https://sdk.bharatx.tech/merchant/credit/initiateTransaction
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)X-Partnerid: partnerId
Body:{  "merchantTransactionId": string, // unique  "userPhoneNumber": string,  "userId": string, // user identifier in perspective of you  "amount": number // in paise}

Show BharatX UI to the user#

Your Android App
bharatxPaymentOption.setOnClickListener(new View.OnClickListener() {  @Override  void onClick(View view) {    String transactionId = // ... from your server    BharatXTransactionManager.confirmTransactionWithUser(      this,      amountInPaise,      transactionId,      new BharatXTransactionManager.TransactionStatusListener() {        @Override         public void onSuccess() {          // transaction success!        }        // optional        @Override        public void onFailure(@NotNull BharatXTransactionManager.TransactionFailureReason reason) {          // transaction cancelled by user or failed        }    });  }});

Check Status of the Transaction#

API#

We recommend you to check transaction status only after the onSuccess SDK callback since that will be simpler. You can check for the status using:

POST https://sdk.bharatx.tech/merchant/credit/checkTransactionStatus
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)X-Partnerid: partnerId
Body:{  "merchantTransactionId": string // unique}

Webhook#

We also send a Webhook to let you know when a Transaction Succeeds or Fails. Your server should respond with a status code 200, and if it doesn't, our server will try to send the webhook again and again with increasing time interval.

POST <Your Server Webhook URL>
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)Content-Type: application/json
Body:{  "merchantTransactionId": string,  "status": string // can be one of ["SUCCESS", "CANCELLED", "FAILURE"]}

Refunds#

warning

If amount is not passed, or if amount is passed as 0, the whole order amount would be refunded.

POST https://sdk.bharatx.tech/merchant/credit/refundTransaction
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)X-Partnerid: partnerId
Body:{  "merchantTransactionId": string,  "amount": number // in paise}