Fetch Balance API

API Command: check_balance

The check_balance API command is used to check the balance using the customer’s mobile number. When using Seamless Integration, integrate this API and display the balance on the Checkout page to your customers.

Environment

Request parameters

ParameterDescriptionExample
command
mandatory
This parameters must contain the API command as check_balance.check_balance
key
mandatory
This parameter must contain your merchant key shared by PayU during onboarding.Your Test Key
hash
mandatory
This parameter contains the hash. Use the following hash generation format: sha512(key|command|var1|salt)
sha512 
var1
mandatory
This parameter must be in a JSON format as described in var1 fields description table.{sodexoSourceId":"src_81e2c860-631b-4b01-aefa-19cfa9c63415"}

📘

Notes:

  • var1 is in a JSON format.
  • All the sub fields are to be sent as a json in var1.
  • The whole JSON string should be used for hash generation.

var1 fields description

The var1 is posted in the following format:

{"walletIdentifier":"AMUL","mobile":"9886575652","ibibo_code":"PAY"}
FieldDesscription
walletidentifierName of the wallet.
ibibo_codeThe bank code of the wallet.
mobileCustomer's mobile number.

Sample request

curl -X POST "https://test.payu.in/merchant/postservice?form=2
-H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d
"key=JP***g&command=check_balance&  var1={"walletIdentifier":"AMUL","mobile":"9886575652","ibibo_code":"PAY"}&hash=fbd44e564f49aaa271250df4fc9fdc5a7eff98d961d6ca8e8049ae0f830d7ee7ff73a4b74c69c9742ccfe0c0478e737c4c685a3fe614ba5ef7edf706097e3346"

Response parameters

ParameterDescriptionExample
statusThis parameter returns the status of web service call. The status can be any of the following:

- 0 - If web service call failed.
- 1 - If web service call succeeded.
1
cardBalanceThis parameter returns the card balance (in rupees).3000.00
cardNameThis parameter contains name of the customer as on the Sodexo card.test

Sample response

Success scenario

{"status":1,"cardBalance":"117.83","cardName":"Madhu Sudhan"}

Failure scenarios

  • Hash is invalid
{"status":0,"msg":"Invalid Hash."}
  • Unable to fetch balance
{"status":0,"msg":"Unable to fetch balance"}
  • Sodexo Source ID is not found
{"status":0,"msg":"Source not found."}