Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Payment

  1. The user enters the required information: the payment amount and the phone number linked to the EasyPaisa account.
  2. A push notification with a payment request is sent to the user's phone.
  3. The user opens the app and confirms the payment.
  4. Paykassma sends a postback to the merchant's side.
  5. The funds are credited to the user's balance on the merchant's platform.

Payment window integration (plugin)

Example of a link to open a EasyPaisa API payment window:

https://plugin.{server_URL}/?
label=label
&currency_code=PKR
&lang=lang
&wallet_type=easypaisa_api
&custom_transaction_id=custom_transaction_id
&fixed_amount=fixed_amount
&payment_url_success_id=2
&payment_url_pending_id=3
&payment_url_fail_id=1
&success_url=hash
&fail_url=hash
&pending_url=hash


Code Block
wallet_type=easypaisa_api
currency_code=PKR
Languages (lang): en, ur
Info

Pay attention to the description of the parameters payment_url_success_id / payment_url_fail_idpayment_url_pending_id and success_url / fail_url pending_url.
To use payment_url_success_id / payment_url_fail_idpayment_url_pending_id you need to send the URLs to Paykassma support and use the received IDs in the parameters.
To use success_url / fail_urlpending_url you must use hashing URLs ( For more details on hashing click here ).

For the description of all the plug-in parameters click here.

API integration

Creating payment

URL: http://api.{ URL server }/api/v1/payment/create/easypaisa_api?secret={pluginapi_secret}

Request method:
POST

Format:
JSON

Parameters:

NameTypeRequiredDescription
secretstringyesAccess key.

Body:

Name

Type

Required

Max Length

Description

amount

float 

yes

min and max are limited by deposit

Payment amount.
currencystringyes3Currency code
labelstring yes190This is the unique identifier (ID) of the user making the payment.
custom_transaction_idstringyes190Transaction ID in the Client's system.
phone_numberstringyes11

The user's phone number. This phone number must be linkedto the usr's account in Easypaisa_api.

Input format: 03xxxxxxxxx, where x is a digit. The length of the entire string including "03" → 11 digits.


Code Block
languagephp
themeDJango
titleRequest
{
  "amount": 2000,
  "currency": "PKR",
  "label": "232323",
  "custom_transaction_id": "test_trx_01",
  "phone_number": "03123456789"
}


Code Block
languagephp
themeDJango
titleResponse Success
{
    "status": "success",
    "message": "",
    "code": 20000,
    "data": {
       "order_id": "4127afd69732325c"
    },
    "paginate": {
        "offset": 0,
        "total": 1,
        "limit": 1
    }
}


Code Block
languagephp
themeDJango
titleResponse Fail
{
    "status": "fail",
    "message": "MESSAGE"
}


Tip
titleHint

After a successful request to create a payment, the user must confirm the payment on their mobile device.

The user is given 1 minute to confirm the payment.


Warning
titleWarning

To avoid multiple requests from the same user or from different accounts from the same wallet, Paykassma will refuse to create an order if the number of unsuccessful attempts by the user in the last 24 hours has reached or exceeded 2. In this case, the user should receive the appropriate error ("Too many requests. Please try again later."), which will help prevent abuse of the system and spam of individual users with multiple payment attempts.


Checking the payment status (optional request)

URL: http://api.{ URL server}/api/v1/payment/status?secret={pluginapi_secret}

Request method:
POST

Format:
JSON

Parameters:

NameTypeRequiredDescription
secretstringyesAccess key

Body:

Name

Type

Required

Max Length

Description

order_id

string

yes

не ограничен

The order number received in response to the request to create a payment in the "order_id" parameter.


Code Block
languagephp
themeDJango
titleRequest
{
  "order_id": "4127afd69732325c"
}


Code Block
languagephp
themeDJango
titleResponse Success (платеж успешно выполнен)
{
    "status": "success",
    "message": "",
    "code": 20000,
    "data": {
        "status": "success"
    },
    "paginate": {
        "offset": 0,
        "total": 1,
        "limit": 1
    }
}


Code Block
languagephp
themeDJango
titleResponse Success (платеж ожидает подтверждения)
{
    "status": "success",
    "message": "",
    "code": 20000,
    "data": {
        "status": "wait"
    },
    "paginate": {
        "offset": 0,
        "total": 1,
        "limit": 1
    }
} 


Code Block
languagephp
themeDJango
titleResponse Success (платеж не выполнен)
{
    "status": "success",
    "message": "",
    "code": 20000,
    "data": {
        "status": "fail"
    },
    "paginate": {
        "offset": 0,
        "total": 1,
        "limit": 1
    }
}


Code Block
languagephp
themeDJango
titleResponse Fail (ошибка запроса)
{
    "status": "fail",
    "message": {
        "order_id": [
            "The selected order id is invalid."
        ]
    }
}

Deposit postback

For the general documentation on post backs click here.

Example of a postback for a EasyPaisa API deposit:

Code Block
languagephp
themeDJango
collapsetrue
{
    "signature": "23ceb452dc398b5f8b0e7ab9eb91236c7ee50911",
    "wallet_type": "easypaisa_api",
    "amount": 1000,
    "currency_code": "PKR",
    "label": "7848747947846",
    "converted_amount": {"USD":3.6,"INR":301, ... , "USDT":3.59692418,"USDTTRC20":0,"USDT20":0},
    "direction": "ingoing",
    "created_datetime": "2023-08-01 13:37:42",
    "access_key": "uowkn0b3LfBxpcWYHi4_",
    "additional_data": [
        {
            "activated_datetime": "2024-05-13 13:05:38",
            "exchanger_identifier": 03xxxxx0957,
            "comment": "",
            "amount": "1000",
            "currency_code": "PKR",
            "wallet_type": "easypaisa_api",
            "stockpiling_id": 2005,
            "transaction_id": "28064319767",
            "transaction_type": 1,
            "plugin_custom_order_id": "1234",
            "withdrawal_id": null,
            "withdrawal_status": null,
            "account_number": "",
            "account_name": "",
            "account_email": "",
            "bank_details": {
                "bank_code": "",
                "branch_code": ""
        	}
        }
    ]
}


Warning
titleWarning

The Paykassma server is waiting for a response in json {"status":"ok"} response code 200, otherwise, when receiving a different response, Paykassma will forward the postback with a certain frequency.
Repeated postbacks must also be answered with {"status":"ok"} response code 200.

Withdrawals for users

Payments to users are made by using EasyPaisa method ( for more details on EasyPaisa method click here).

Table of Contents
excludeОглавление: