Fetch Balance API – Sodexo Integration

API Command: check_balance

The Fetch Balance check_balance API command is used to check the balance of a Sodexo card. When using Seamless Integration, integrate this API and display the balance on the Checkout page to your customers.

HTTP Method: POST

Environment

Request parameters

ParameterDescriptionExample
key
mandatory
This parameter must contain your merchant key shared by PayU during onboarding.Your Test Key
command
mandatory
This parameters must contain the API command as check_balance.check_balance
hash
mandatory
This parameter contains the hash. Use the following hash generation format:
sha512(key|command|var1|salt)
sha512
 
var1
mandatory
This parameter must contain the Sodexo Source ID in JSON format as provided in the example.{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.
  • sourceId is shared by PayU with merchants in the field3 parameter in any of the following API responses for all successful transactions wherever customer has provided permission to save their card.

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={"sodexoSourceId":"src_81e2c860-631b-4b01-aefa-19cfa9c63415"}&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
cardNoThis parameter contains the Sodexo card number.637513XXXXXX9318
cardBalanceThis parameter returns the card balance (in rupees).3000.00
cardNameThis parameter contains name of the customer as on the Sodexo card.test
msgThis parameter contains the message, that is successful or failure.success

Sample response

Success scenario

{"status":1,"cardNo":"637513XXXXXX9318","cardBalance":".82","cardName":"test","msg":"success"}

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."}