Easypaisa Mobile Account API Integration Guide
Easypaisa Mobile Account API Integration Guide
Easypaisa Mobile Account API Integration Guide
Table of Contents
Page | 2
Easypaisa – RSA 2048 Encryption Guide
Easypaisa is an electronic payment solution that easily and seamlessly integrates with any online
website and/or shopping cart and enables users to pay online through Payment Gateway. Easypaisa is
built upon the latest state of the art technologies and toolset that leverages many features a secure
payment solution system must have. The users require no special technology or business license; only
a valid email address to have an account on Easypaisa.
Page | 3
Easypaisa – RSA 2048 Encryption Guide
2. RSA Encryption
In order to use the web-services of OPS, it is necessary for the client to send a digital signature along with
each API request. This signature is used by Easypaisa to authenticate the client before processing the request.
The steps required to perform this encryption are described below:
Client and Easypaisa must exchange RSA keys before making API calls, and the length of RSA key must be 2048
bits. When making API call to Easypaisa, client uses the RSA private key to sign the API request. After receiving
the API request, Easypaisa will use the client’s RSA public key to verify whether the signature is matched to
the content of API request. Similarly, when client receives the API response, it is highly recommended that
client verifies the signature of API response by using Easypaisa’s RSA public key.
Log in to the portal and visit the following path: “Account Settings -> Public Key Configuration -> Upload Public
Key”. Upload your public key here.
On the same path, enter the “Easypaisa Public Key” tab and click on the download
button to download Easypaisa public key.
Page | 5
Easypaisa – RSA 2048 Encryption Guide
1. Extract the content to be signed and trim un-necessary spaces, For example:
{"orderId":"ZS109","storeId":"641","transactionAmount":"25","transactionType":"MA","msisdn":"",
"mobileAccountNo":"03458509176","emailAddress":"faisal.nazir@systemsltd.com","tokenExpiry":"
20190425001250","optional1":"33","optional2":"gdgsdfgdf","optional3":"tert35t43535","optional4" :"3423@@$$#","optional5":"423423"}
2. Hash the JSON content by using the SHA256withRSA algorithm. Then use the client's RSA
private key to sign the value to obtain the signature. To achieve a better security level, the length
of the RSA key/pairs must be 2048 bits. The following sample illustrates a raw signature:
sXSGdA4tR4B0wnF6Nr8ShpfNMtHISWuzLpdKoNWskIgCcspMVFFzgkez4BrmtYXkMqZh1tyz/8sNNU3F2VTu0fO
x+ZP4CnmVjNu8bciu4hTtnytA3Y1GZ/yXAUD+mVYGXeyDO3fHrqDdI7k3xV/Q8FCOd0culTsN6RRMxMZq+oqR2x
+EjOXVofp7BZJwhQE8Us4Al573FQz5EHDvCLx35lq2hoMhXLCVLVDBHcpCgotuY4mg91MXh/qqcFGY/hQKhGdWA
bZ9tcp2Q5s2ESh37rqxnOwZrrepK8NC6vMBPUiSPxQefpev2nG0JzAHOjRPbBXYw1XBS6RBYKAmufZZiQ==
c1hTR2RBNHRSNEIwd25GNk5yOFNocGZOTXRISVNXdXpMcGRLb05Xc2tJZ0Njc3BNVkZGemdrZXo0QnJtdFlYa01
xWmgxdHl6LzhzTk5VM0YyVlR1MGZPeCtaUDRDbm1Wak51OGJjaXU0aFR0bnl0QTNZMUdaL3lYQVVEK21WWUdYZX
lETzNmSHJxRGRJN2szeFYvUThGQ09kMGN1bFRzTjZSUk14TVpxK29xUjJ4K0VqT1hWb2ZwN0JaSndoUUU4VXM0Q
Ww1NzNGUXo1RUhEdkNMeDM1bHEyaG9NaFhMQ1ZMVkRCSGNwQ2dvdHVZNG1nOTFNWGgvcXFjRkdZL2hRS2hHZFdB
Ylo5dGNwMlE1czJFU2gzN3JxeG5Pd1pycmVwSzhOQzZ2TUJQVWlTUHhRZWZwZXYybkcwSnpBSE9qUlBiQlhZdzF
YQlM2UkJZS0FtdWZaWmlRPT0=
After receiving a response, perform the following steps to verify the signature:
Page | 6
Easypaisa – RSA 2048 Encryption Guide
1. Split the full response contents to 2 parts, the response JSON string and the signature
string, by using the regular expression instead of JSON object.
2. Trim any un-necessary spaces (if any) and hash the response JSON string by using
the SHA256 algorithm to obtain a message digest.
3. Use the public key to decrypt the signature to a message digest.
4. Compare the two message digests obtained in step 2 and step 3. If the digests are
the same, then it indicates that the signed data has not been changed.
3.1 Header
Header value Description
Header key
Base64Encoded Partner Account username &
Credentials
username:password password for authentication
Page | 7
Easypaisa – RSA 2048 Encryption Guide
Code : Description
0000 = SUCCESS
0001 = SYSTEM ERROR
0002 = REQUIRED FIELD MISSING
0005 = MERCHANT ACCOUNT NOT ACTIVE
Page | 8
Easypaisa – RSA 2048 Encryption Guide
Page | 9