Skip to main content

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

Project description

Paytring\Python

Set-Up key and secret in env

key = "{{Your key}}"
secret = "{{Your secret}}"

Usage

from paytring.client import Order

Create Order

Create instance of class Order
order = Order()

Input Parameter

  • Receipt ID(string)
  • Amount(string)
  • Callback Url(string)
  • Customer Info ( Dictionary )
  • Currency

Function

customer_info = {
    "cname": "test",
    "email": "abc@gmail.com",
    "phone": "phone"
}


order.create(
    receipt_id,
    amount,
    callback_url,
    customer_info,
    currrency
)
Response
{
"status": true,
"url": "www.makepayment.com",
"order_id": "365769619161481216"
}

Fetch Order


Input Parameter

  • Order ID(string)

Function


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 Parameter

  • Receipt ID(string)

Function


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 Parameter

  • Order ID(string)

Function


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.0.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

paytring-1.0.0-py3-none-any.whl (6.7 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