Package: paytring
Paytring\PythonInstallationThe source code is currently hosted on GitHub at :https://github.com/paytring/python-sdkBinary installers for the latest released version are available at the Python Package Index (PyPI)pip install paytringSet-Up Environment Variablesimport  os
os.environ['key'] = "your_key"
os.environ['secret'] = "your_secret"Payment Usagefrom paytring.client import OrderCreate Instanceorder = Order()Create OrderInput ParameterReceipt ID(string)Payment_Info (Dictionary)Callback Url(string)Customer Info ( Dictionary )Optional ParametersBilling Info ( Dictionary )Shipping Info ( Dictionary )Notes ( Dictionary )TPV ( Dictionary )PG (String)PG Pool ID (String)Methodspayment_info={"amount":"100","currency":"INR"# currency INR or USD}customer_info={"cname":"test","email":"abc@gmail.com"->itwillbebaseEncode256,"phone":"9999999999"}billing_info={"firstname":"John","lastname":"Doe","phone":"09999999999","line1":"Address Line 1","line2":"Address Line 2","city":"Gurugram","state":"Haryana","country":"India","zipcode":"122001"}shipping_info={"firstname":"John","lastname":"Doe","phone":"09999999999","line1":"Address Line 1","line2":"Address Line 2","city":"Gurugram","state":"Haryana","country":"India","zipcode":"122001"}notes={"udf1":"udf1","udf2":"udf2","udf3":"udf3",}tpv=[{"name":"Test","account_number":"0000001234567890","ifsc":"BankIFSC0001"}]response=order.create(receipt_id,callback_url,payment_info,customer_info,billing_info(optioanl),shipping_info(optioanl),notes(optioanl),tpv(optioanl),pg(optioanl),pg_pool_id(optional))Response{
"status": true,
"url": "www.makepayment.com",
"order_id": "365769619161481216"
}Fetch OrderInput ParameteOrder ID(string)Methodsorder.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": "John",
            "email": "abc@gmail.com",
            "phone": "9999999999"
        },
        "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-IDInput ParameteReceipt ID(string)Methodsorder.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": "test",
            "email": "abc@gmail.com",
            "phone": "9999999999"
        },
        "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 OrderInput ParametersOrder ID(string)Methodsorder.refund(
    order_id
)ResponseSuccess Response{
    "status": true,
    "message": "Refund has been initiated"
}Error Response{
    "status": false,
    "error": {
        "message": "error message here",
        "code": 204
    }
}Process OrderInput ParametersOrder ID(string): ORder id got in response when order is created on paytringMethodCodeOptional ParametersVPA(String) : Only required if method is upi and code is collectCard : Only required if method & code is cardDevice : Mandatory if method is upi and code is intent, eg. android, ioscard = {'number': "1234XXXXXXXXXXX",
        'cvv': "123", 
        "expiry_month": "07", 
        "expiry_year": "21", 
        "holder_name": "John Doee" 
    }Methodsorder.process_order(order_id="paytring order id", method='card', code='card',  card=card)Response{   
    'status': True, 
    'payment_id': '586493765254906097', 
    'data': {'type': 'otp', 'url': ' ', 'param': [], 'resend_url': ' ', 'resend_param': []
    }
}Validate VPAInput ParametersVPA(String) : VPA number you want to validateMethodsorder.validate_vpa(vpa='vpa')Response{   
    'status': True, 
    'isVPAValid': True, 
    'payerAccountName': 'John Doee'
}Validate CardInput Parametersbin : Card bin you want to be validated.( first 6 digits of card number )Methodsresponse = order.validate_card(bin='438976')Response{   
    'status': True, 
    'isCardValid': True, 
    'payerAccountName': 'John Doee'
}Subscription Usagefrom paytring.client import SubscriptionCreate Instancesubscription = Subscription()Create PlanInput ParameterPlan ID(string)Payment_Info (Dictionary)Plan Info ( Dictionary )Notes ( Dictionary )Methodspayment_info={"amount":"100","currency":"INR"# currency INR or USD}plan_info={"title":"Daily 1 rupee plan","description":"test plan","frequency":"1","cycle":"12",}notes={"udf1":"udf1","udf2":"udf2","udf3":"udf3",}response=subscription.create_plan(plan_id,payment_info,plan_info,notes)Response{
    'status': True,
    'plan_id': '552678261629388919'
}Fetch PlanInput ParametePlan ID(string)Methodssubscription.fetch_plan(
    plan_id
)Response{
    'status': True,
    'plan': {
        'plan_id': '552678261629388919', 
        'mer_reference_id': 'PLAN1234768547984', 
        'amount': 100, 
        'currency': 'INR', 
        'plan_status': 'created', 
        'frequency': '1', 
        'cycle': '12', 
        'notes': {
            'udf1': 'udf1',
            'udf2': 'udf2', 
            'udf3': 'udf3'
        }
    }
}Fetch Plan By Receipt-IDInput ParameteReceipt ID(string)Methodssubscription.fetch_plan_by_receipt_id(
    receipt_id
)Response{
    'status': True,
    'plan': {
        'plan_id': '552678261629388919', 
        'mer_reference_id': 'PLAN1234768547984', 
        'amount': 100, 
        'currency': 'INR', 
        'plan_status': 'created', 
        'frequency': '1', 
        'cycle': '12', 
        'notes': {
            'udf1': 'udf1',
            'udf2': 'udf2', 
            'udf3': 'udf3'
        }
    }
}Error Response{
    "status": false,
    "error": {
        "message": "error message here",
        "code": 204
    }
}Create SubscriptionInput ParameterReceipt ID (string)Plan ID (string)Callback Url(string)Customer Info ( Dictionary )Optional ParametersBilling Info ( Dictionary )Shipping Info ( Dictionary )Notes ( Dictionary )PG (String)PG Pool ID (String)Methodspayment_info={"amount":"100","currency":"INR"# currency INR or USD}customer_info={"cname":"test","email":"abc@gmail.com"->itwillbebaseEncode256,"phone":"9999999999"}billing_info={"firstname":"John","lastname":"Doe","phone":"09999999999","line1":"Address Line 1","line2":"Address Line 2","city":"Gurugram","state":"Haryana","country":"India","zipcode":"122001"}shipping_info={"firstname":"John","lastname":"Doe","phone":"09999999999","line1":"Address Line 1","line2":"Address Line 2","city":"Gurugram","state":"Haryana","country":"India","zipcode":"122001"}notes={"udf1":"udf1","udf2":"udf2","udf3":"udf3",}response=subscription.create_subscription(receipt_id,plan_id,callback_url,customer_info,billing_info(optioanl),shipping_info(optioanl),notes(optioanl),pg(optioanl),pg_pool_id(optional))Response{
"status": true,
"url": "https://api.paytring.com/pay/subscription/87583758943797",
"subscription_id": "87583758943797"
}Fetch SubscriptionInput ParametersSubscription ID(string)Methodssubscription.fetch_subscription(
    subscription_id
)Response{
    'status': True,
    'subscription': {
        'subscription_id': '552679210171237835', 
        'mer_reference_id': '6574363653869523845', 
        'amount': 100, 
        'currency': 'INR', 
        'subscription_status': 'active'
    }
}Fetch Subscription By Receipt-IDInput ParametersReceipt ID(string)Methodssubscription.fetch_subscription_by_receipt_id(
    receipt_id
)Response{
    'status': True,
    'subscription': {
        'subscription_id': '552679210171237835', 
        'mer_reference_id': '6574363653869523845', 
        'amount': 100, 
        'currency': 'INR', 
        'subscription_status': 'active'
    }
}Error Response{
    "status": false,
    "error": {
        "message": "error message here",
        "code": 204
    }
}Currency Conversion Usagefrom paytring.client import SettlementCreate Instancecurrency = CurrencyConversion()Input Parameterscurrency_from(String)currency_to(String)Accpted Currencies : INR|USD|AUD|BGN|CAD|EUR|JPY|NZD|QAR|SGD|KRW|CHF|GBP|AED|NZDMethodscurrency.convert_currency(currency_from='USD', currency_to='IND')Response{   'status': True, 
    'data': {'from': 'USD', 'to': 'INR','rate': '83.02'}
}