Ola Money Developer Hub

Welcome to the Ola Money developer hub. You'll find comprehensive guides and documentation to help you start working with Ola Money as quickly as possible, as well as support if you get stuck.

Documentation

Bill Generator

What is a Bill?

A bill is a signed JSON from the merchant server. Ola Money uses SHA512 to sign the bill. It prevents tampering attempts.

What is a bill required for?

Many Olamoney Api's take a bill as a parameter

How do you generate a bill

Bill has to be generated by the merchant server. Here are the steps:

  • On click of payment through Ola Money on your App or WebSite make a call to your server in order generate a bill for the transaction.

Request Bill Format

The JSON bill typically looks as below

{
"command":"debit",
"accessToken":"ola_access_token",
"uniqueId":"TXN1232434343555523",
"comments":"optional",
"udf":"optional",
"hash":"3ce32cf5dd8ad19909fa944dbb67e82260db059590546fad676ba859654477447080ef7a6262b91be36ce5e3260d525d977da632957b9822499134dd96a076c1",
"returnUrl":"http://myweb.com/myreturn_url.php",
"notificationUrl":"http://myweb.com/mynotify_url.php",
"amount":"100.00",
"currency":"INR",
"couponCode":"NA" //(you can pass a coupon code whenever a cashback offer has to be run)
}

Request Explained :

Parameter Name
Description
Type
Mandatory
Default Value

command

Type of Transaction with respect to the user
Possible Values : debit

Callout : The command name has to be exactly the possible value without the change in the case of the string

String

Yes

debit

accessToken

A key which uniquely identifies you in the Ola Money system.
Avalilable on Ola Money Dashboard

String

Yes

NA

uniqueId

A unique transaction ID provided by you.
The generation of uniqueId completely lies with you.

Suggestion : Preferably generate a randomized and long unique Id (8-20 characters) .

String

Yes

NA

comments

An alphanumeric string used to add any comments or user data for your reference

Callout:This field cannot be an empty string

String

Yes

Ex:uniqueId generated

udf

User Defined Field to store significant merchant's user data.

Callout:This field cannot be an empty string

String

Yes

Ex:uniqueId generated

hash

Ola Money uses SHA512 to sign the bill in order to prevent tampering attempts.

String

Yes

NA

returnUrl

This is a url hosted on your server where we redirect the user after the transaction is complete. This redirect happens in your web-view.

Callout : This should be a valid URL capable of accepting post parameters posted in response to the transaction

String

Yes

NA

notificationUrl

This is a url hosted on your server where we post the details of the transaction after the transaction is complete. This is a server to server call.

String

Yes

NA

amount

Transaction amount which you wish to charge the user for.

Callout: This should be a decimal with exactly two digits in the mantissa or the fractional part

Double

Yes

0.00

currency

currency of the payment made.
Possible Values : INR

String

Yes

INR

couponCode

This is the name of the coupon Ola Money team generated in collaboration with you for cashback offers

Suggestion: User will get appropriate cashback based on coupon you passed here.If you wish to keep the field but intend to not pass coupon you can pass a string "NA"

String

No

NA

How do I generate Hash ?

What is a Hash?

A hash value (or simply hash) is a number generated from a string of text. Ola Money uses SHA512 to sign the bill in order to prevent tampering attempts.

How is the hash generated

Merchant server generates the hash as part of Bill generation. Salt is needed to generate the Hash which should be kept Secret.

Hash is generated in the following format, using SHA-512:

Salt needed to generate the Hash is available on Ola Money Merchant Dashboard.This has to stored securely.Any compromise to the salt may lead to an attack.

hash = sha512('access_token|uniqueId|comments|udf|returnUrl|notifyUrl|currency|amount|couponCode|salt');

Hash Calculation Pitfal

All parameters are mandatory and amount should be a decimal value with exactly two digits in the fractional part.

The order of the parameters for the Hash generation should be exactly same as described below in the code snippet

Why do we use SHA512?

Of all the Hash functions available, the SHA-2 family is currently among the strongest, and the best choice considering commonness, analysis, and security.

The code snippet for generating this hash would depend on your server side technology. You can find some examples of ready-made code snippets on our Github page, and some examples are below:

import hashlib
hash_object = hashlib.sha512(b'ola_access_token|TXN1232434343555523|optional|optional|http://myweb.com/myreturn_url.php|http://myweb.com/mynotify_url.php|INR|100.00|OMOFFER|ola_salt')
ola_hash = hash_object.hexdigest()
<?php
$ola_hash = openssl_digest('ola_access_token|TXN1232434343555523|optional|optional|http://myweb.com/myreturn_url.php|http://myweb.com/mynotify_url.php|INR|100.00|OMOFFER|ola_salt', 'sha512');
?>

Link to Code-Snippets on Github :

Bill Generator