Skip to main content

A SDK which helps to create, fetch or refund an order on Paytring

Project description

Paytring\Python


Installation


The source code is currently hosted on GitHub at : https://github.com/paytring/python-sdk

Binary installers for the latest released version are available at the Python Package Index (PyPI)

pip install paytring

Set-Up Environment Variables


import  os
    os.environ['key'] = "your_key"
    os.environ['secret'] = "your_secret"

Usage


from paytring.client import Order

Create Instance

order = Order()

Create Order


Input Parameter
  • Receipt ID(string)
  • Amount(string)
  • Callback Url(string)
  • Customer Info ( Dictionary )
  • Currency (String : INR or USD)
Optional Parameters
  • PG (String)
  • PG Pool ID (String)

Methods

customer_info = {
    "cname": "test",
    "email": "abc@gmail.com" -> it will be baseEncode256,
    "phone": "phone"
}


order.create(
    receipt_id,
    amount,
    callback_url,
    customer_info,
    currrency,
    pg(optioanl),
    pg_pool_id(optional)
)

Response

{
"status": true,
"url": "www.makepayment.com",
"order_id": "365769619161481216"
}

Fetch Order


Input Paramete
  • Order ID(string)

Methods


order.fetch(
    order_id
)

Response

{
    "status": true,
    "order": {
        "order_id": "489651149222183338",
        "receipt_id": "testmode323",
        "pg_transaction_id": "489651179018519803",
        "amount": 100,
        "currency": "INR",
        "pg": "RazorPay",
        "method": "UPI",
        "order_status": "success",
        "unmapped_status": "captured",
        "customer": {
            "name": "sudeep",
            "email": "sudeep@yopmail.com",
            "phone": "8960444555"
        },
        "notes": {
            "udf1": "",
            "udf2": "",
            "udf3": "",
            "udf4": "",
            "udf5": "",
            "udf6": "",
            "udf8": "",
            "udf9": "",
            "udf10": ""
        },
        "billing_address": {
            "firstname": "",
            "lastname": "",
            "phone": "",
            "line1": "",
            "line2": "",
            "city": "",
            "state": "",
            "country": "",
            "zipcode": ""
        },
        "shipping_address": {
            "firstname": "",
            "lastname": "",
            "phone": "",
            "line1": "",
            "line2": "",
            "city": "",
            "state": "",
            "country": "",
            "zipcode": ""
        },
        "additional_charges": 0,
        "mdr": ""
    }
}

Fetch Order By Receipt-ID


Input Paramete

  • Receipt ID(string)

Methods


order.fetch_by_receipt_id(
    receipt_id
)

Response

{
    "status": true,
    "order": {
        "order_id": "489651149222183338",
        "receipt_id": "testmode323",
        "pg_transaction_id": "489651179018519803",
        "amount": 100,
        "currency": "INR",
        "pg": "RazorPay",
        "method": "UPI",
        "order_status": "success",
        "unmapped_status": "captured",
        "customer": {
            "name": "sudeep",
            "email": "sudeep@yopmail.com",
            "phone": "8960444555"
        },
        "notes": {
            "udf1": "",
            "udf2": "",
            "udf3": "",
            "udf4": "",
            "udf5": "",
            "udf6": "",
            "udf8": "",
            "udf9": "",
            "udf10": ""
        },
        "billing_address": {
            "firstname": "",
            "lastname": "",
            "phone": "",
            "line1": "",
            "line2": "",
            "city": "",
            "state": "",
            "country": "",
            "zipcode": ""
        },
        "shipping_address": {
            "firstname": "",
            "lastname": "",
            "phone": "",
            "line1": "",
            "line2": "",
            "city": "",
            "state": "",
            "country": "",
            "zipcode": ""
        },
        "additional_charges": 0,
        "mdr": ""
    }
}

Refund Order


Input Paramete
  • Order ID(string)

Methods


order.refund(
    order_id
)

Response

Success Response

{
    "status": true,
    "message": "Refund has been initiated"
}

Error Response

{
    "status": false,
    "error": {
        "message": "error message here",
        "code": 204
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paytring-1.0.3.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

paytring-1.0.3-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page