-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
43 lines (29 loc) · 1.11 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import requests
import json
# import checksum generation utility
# You can get this utility from https://developer.paytm.com/docs/checksum/
import PaytmChecksum
# initialize a dictionary
paytmParams = dict()
# body parameters
paytmParams["body"] = {
# Find your MID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
"mid" : "YOUR_MID_HERE",
# Enter your order id which needs to be check status for
"orderId" : "YOUR_ORDER_ID",
}
# Generate checksum by parameters we have in body
# Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
checksum = PaytmChecksum.generateSignature(json.dumps(paytmParams["body"]), "YOUR_MERCHANT_KEY")
# head parameters
paytmParams["head"] = {
# put generated checksum value here
"signature" : checksum
}
# prepare JSON string for request
post_data = json.dumps(paytmParams)
# for Staging
url = "https://securegw-stage.paytm.in/v3/order/status"
# for Production
# url = "https://securegw.paytm.in/v3/order/status"
response = requests.post(url, data = post_data, headers = {"Content-type": "application/json"}).json()