Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2016
What would you like to do?
Script to pull data from MemberPress using the WordPress Rest API
import json
if input['desc'] == 'MP Test':
membership = 14
elif input['desc'] == 'MP Example':
membership = 99
return {'status': 'Invalid button'}
# Get member_id
r = requests.get('' + input['email'])
members = json.loads(r.text)
member = members[0]
# Create new transaction (POST)
r ='', json={"member":member['id'],"membership":membership,"trans_num":input["trans_num"],"amount":input["amount"],"status":"complete","gateway":input["gateway"]})
# r.raise_for_status()
transaction = json.loads(r.text)
return {'member':member,'membership':membership,'transaction':transaction}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment