SecurePay-PYTHON (PA)

#!/usr/bin/python
import urllib
import urllib2
import json

def prepareCheckout(): 
	url = "https://test.oppwa.com/v1/checkouts"
	data = {
		"authentication.userId": "8a8294184f45ce7e014f4b1d16cc12df",
		"authentication.password": "j3zCJ2ENaD",
		"authentication.entityId": "8a8294184f45ce7e014f4b1d16bd12db",
		"paymentType": "PA",
		"amount": "50.99",
		"currency": "RSD"
	}
	try:
		response = urllib2.urlopen(url, urllib.urlencode(data) )
		return json.loads(response.read());
	except urllib2.HTTPError, e:
		return e.code;

checkoutId = prepareCheckout()["id"];
print checkoutId