qr init API of phone pe

136 views
Skip to first unread message

Prerana Bhat

unread,
Oct 12, 2022, 11:43:09 AM10/12/22
to Django users
Hello everyone, 
So I am trying to work on a task that when the user scans the qr code it redirects it to the payment with the given amount.
I tried using the qr init API provided by phone pe but its showing internal server error. Can anyone tell me wat might be wrong
below is my views.py file

from django.shortcuts import render
import requests

# Create your views here.
def makeqr(request):
    url = "https://mercury-uat.phonepe.com/v3/qr/init"
    headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
  
    }
    data = {
    "merchantId": "MERCHANTUAT",
    "transactionId": "TX32321849644234",
    "merchantOrderId": "TX32321849644234",
    "amount": 1000,
    "storeId": "234555",
    "terminalId": "894237",
    "expiresIn": 1800,
    "gstBreakup": {
       "gst": 100,
       "cgst": 25,
       "cess": 25,
       "sgst": 25,
       "igst": 25,
       "gstIncentive": 100,
       "gstPercentage": 10
        },
    "invoiceDetails": {
    "invoiceNumber": "123456fffff##_##",
    "invoiceDate": "2021-06-29T10:13:54.022Z",
    "invoiceName": "bccbd_cjdcdjc******"
    }
    }
    response = requests.post(url,headers=headers,json=data)
    print(response.text)
    return render(request,"home.html")
Reply all
Reply to author
Forward
0 new messages