Document Control

 

Document Number:01/022

26th April 2022
Version
1.0
 
Created/Modified By : Technical Business Analyst
Reviewed By : CTO
Remarks/ Amendment : Draft Created
3rd August 2022
Version
1.0
 
Created/Modified By : Technical Business Analyst
Reviewed By : CTO
Approved By : CEO
Remarks/ Amendment : Draft Created
1st August 2022
Version
0.1
 
Created/Modified By : Technical Business Analyst
Reviewed By : CTO
Remarks/ Amendment : Draft Created

Introduction

MyPay has developed a robust payments engine that permits you to receive, manage and pay funds. This service is accessible to MyPay’s purchasers through a collection of easy-to-user relaxing APIs with JSON payloads. The central plan is to cut back the price, risk and energy commonly related to managing complicated cash movements that will help you to target growing your business.

Our purchasers will receive and reconcile funds via Real-time transfers, direct credits/debits using MyPay Wallet. Our purchasers pay funds via Real-time transfers direct credits using MYPAY wallets/Banks. Moving cash between numerous MyPay accounts is additionally real time. All cash flows (in and out) of the Engine are as quick because the banking industry permits.

Purpose of the document

The purpose of this document is to provide details of the technical specifications of MyPay Checkout API integration with third party (i.e. various merchants who accepts alternate payment than cash) using APIs.

The sandbox atmosphere is for testing to be used by Developer Portal at no price. The sandbox atmosphere permits you to check out the practicality of our API in a free development atmosphere. Access to the live atmosphere is granted once you've got our compliance method and had formal sign-off on your sandbox integration.

API documentation for Order creation is provided below with API authentication details and basic input output parameters and API URLs

Getting Started

  • Merchant Signup request can be sent to MyPay on mail at merchant@mypay.com.np
  • Sign into our Merchant Portal.
  • You will need to Reset your password the first time you login and authenticate.
  • Get your sandbox API key under Dashboard in the Merchant Portal
  • Browse this document to find the functions you need
  • Start using your first API calls by sending HTTP requests to the Order APIs described in this document
  • Use the provided examples in the document as guidance

Authentication

All RESTful APIs in this document use API KEY for authentication and this key can be obtained from the merchant dashboard.

Sandbox Authentication Credentials

Field Value
Username Username MyPay merchant username (Same as used for Login into Merchant Portal )
Password Initial API password provided by MyPay admin or new password reset by Merchant
Base URL https://testapi.mypay.com.np
API Headers Content-Type: application/json | API_KEY: Obtained from merchant dashboard
API Key for Sandbox
API_Key: urhYBpW+9sl8NjBb/ek3fzy0OqdXAQAlQw4TWUo92v8=

Live Authentication Credentials

Field Value
Username MyPay merchant username(Same as used for Login into Business Portal)
Password Initial API password provided by MyPay admin or new password reset by Merchant
Base URL https://smartdigitalnepal.com/
API Headers Content-Type: application/json | API_KEY: Obtained from merchant dashboard
To try out our API you can use a client such as Postman
API_Key: - (obtained from the Developer Portal) Production credentials will be supplied by MyPay when you have demonstrated successful implementation of the API on our Sandbox environment
UserName: When using MyPay Payments API with your API Key, UserName is required for authentication.
Password: When using MyPay Payments API with your API Key, API password is required for authentication.

Financial / Payments

Overview

The Financial APIs provide the core financial functionality of the Engine such as standard directentry transactions, refunds and status information.

You may Debit by using following sources

MyPay Merchant Wallets to Bank Accounts

You may Credit by using following sources

User Transaction Amount to MyPay Merchant Wallets

API Requests and Responses

Start making API calls

MyPay recommends starting with the Orders API. These steps will use the Orders API to create an order and capture payment using sandbox accounts linked to your developer account (SANDBOX)

Environment for Live and Sandbox Application is handled by below URLs

Sandbox Authentication Credentials

Sandbox API URL https://stagingapi1.mypay.com.np/
Live API URL https://smartdigitalnepal.com/

Start Creating Orders

Generate Order API

For order generation, following API will be called

Request Method Request URL
POST https://stagingapi1.mypay.com.np/api/use-mypay-payments
API INPUT Expand
{
"MerchantTransactionId": "210720220704044498293897245",
"MemberContactNumber": "",
"Status": 5,
"Remarks": "Order Awaiting User Login and Payment",
"TrackerId": "",
"OrderId": "104999",
"Message": "Status Fetched Successfully",
"responseMessage": "",
"Details": "Status Fetched Successfully for Order ID: 104999",
"ReponseCode": 1,
"status": true,
"ios_version": "9.3",
"AndroidVersion": "3.1.5"
}
                        
API HEADERS
API_KEY To be provided By MyPay
Content-Type application/json
Output
{
" MerchantTransactionId": "210720220704044498293897245",
"RedirectURL":"https://staging1.mypay.com.np/MyPayPayments?OrderToken=N5LH49ji7A1idanH1CnhbNmIrgSjF6LP8G0P1RKQOANvf%2bFU3SH%2bSwcDdWHfxlKjqaFWmkxPoIhOEAXxFgp5TQ%3d%3d&mid=3I260%2bCSLP0Vc4XWOZ9fHA%3d%3d",
"Message": "Success",
"responseMessage": "",
"Details": "Transaction Success Txn ID: 210720220704044498293897245",
"ReponseCode": 1,
"status": true,
"ios_version": "9.3",
"AndroidVersion": "3.1.5"
}

                        
Note The "RedirectURL" received in JSON Output from API output will be passed to the MyPay Portal for Payment. Please check the User Panel Section in the document.

User Panel

SANDBOX URL:

https://staging1.mypay.com.np/MyPayPayments?OrderToken=N5LH49ji7A1idanH1CnhbNmIrg SjF6LP8G0P1RKQOANvf%2bFU3SH%2bSwcDdWHfxlKjqaFWmkxPoIhOEAXxFgp5TQ%3 d%3d&mid=3I260%2bCSLP0Vc4XWOZ9fHA%3d%3d

LIVE URL:

https://webdemo.mypay.com.np/MyPayPayments?OrderToken=N5LH49ji7A1idanH1CnhbNmIr gSjF6LP8G0P1RKQOANvf%2bFU3SH%2bSwcDdWHfxlKjqaFWmkxPoIhOEAXxFgp5TQ% 3d%3d&mid=3I260%2bCSLP0Vc4XWOZ9fHA%3d%3d

On opening the above URL, the following login screen will open up, where the user will enter the phone number and password for authentication.

On successful authentication from the user, the transaction detail page will be shown as shown below

If user has sufficient balance to pay (i.e. Balance > Amount) then user can proceed for payment. Otp will be sent on PROCEED TO PAY which is used for transaction authentication process

On successful OTP verification, the response will be posted on ReturnUrl by appending gateway transaction id, merchant transaction id and Order id as
Format : https://www.google.com/?GatewayTransactionId=22052023085530553030392531512&Merchant TransactionId=22052023085357535765837288123&TrnxId=11562512

Where,

ReturnUrl https://www.google.com
Gateway Transaction Id 22052023085530553030392531512
Merchant Transaction Id 22052023085357535765837288123
Order Id 11562512

OR
If canceled by user then the response will be posted on same ReturnUrl with same format, so need to call the check status API in order to check the final status of the transaction.

In case of not passing the ReturnUrl, the response will be posted on success or cancel URL; based on the transaction status. This Static Success URL and Cancel URL of Merchant will be added by Admin at the time of Merchant Created from Admin.

If the user does not have sufficient balance to pay (i.e. Balance < Amount) then insufficient balance will appear as shown in the image below. Only cancel option will be available to customer to cancel the transaction.

Check Transaction Status API

At this stage since order is created at Backend, Check Status API can be used at any point of time to fetch the current status of the order using TransactionId. Please refer below Check Status API

Request Method Request URL
POST https://stagingapi1.mypay.com.np/api/use-mypay-payments-status
API INPUT Expand
{
"MerchantTransactionId": "210720220704044498293897245"
}
                        
API HEADERS
API_KEY To be provided By MyPay
Content-Type application/json
OUTPUT Expand
{
"MerchantTransactionId": "210720220704044498293897245",
"MemberContactNumber": "",
"Status": 5,
"Remarks": "Order Awaiting User Login and Payment",
"TrackerId": "",
"OrderId": "104999",
"Message": "Status Fetched Successfully",
"responseMessage": "",
"Details": "Status Fetched Successfully for Order ID: 104999",
"ReponseCode": 1,
"status": true,
"ios_version": "9.3",
"AndroidVersion": "3.1.5"
}

                        
Note Check status API can also be called using GatewayTransactionId too as shown below
GatewayTransactionId 26072022104346434668817121930

HTTP STATUS CODES WITH DESCRIPTION:

Status Code Description
1 Success
2 Failed
3 Cancelled
4 Pending
5 Incomplete
API RESPONSE:
Following JSON Output is received from Transaction Status API, when order is completed and payment is successfully complete
{
"MerchantTransactionId": "2507202201062762781754016475",
"MemberContactNumber": "8178642080",
"Status": 1,
"Remarks": "Order Completed for Contact no.8178642080",
"TrackerId": "2507202201091891834088151170",
"OrderId": "169899",
"Message": "Status Fetched Successfully",
"responseMessage": "",
"Details": "Status Fetched Successfully for Order ID:169899",
"ReponseCode": 1,
"status": true,
"ios_version": "9.3",
"AndroidVersion": "3.1.5"
}