Last active
October 2, 2015 19:15
-
-
Save dbrent-amazon/b9604ed8ccc2030d5385 to your computer and use it in GitHub Desktop.
InstantPaymentNotification (Flask)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import request | |
@app.route('/ipn_handler', methods=['GET', 'POST']) | |
def ipn_handler(): | |
from pay_with_amazon.ipn_handler import IpnHandler | |
response = IpnHandler(request.data, request.headers) | |
if response.authenticate(): | |
return(response.to_json()) | |
else: | |
return(response.error) | |
# example response | |
{ | |
"OrderReferenceNotification": { | |
"OrderReference": { | |
"OrderTotal": { | |
"CurrencyCode": "USD", | |
"Amount": "0.0" | |
}, | |
"CreationTimestamp": "2013-01-01T01:01:01.001Z", | |
"OrderReferenceStatus": { | |
"State": "Closed", | |
"ReasonCode": "AmazonClosed", | |
"LastUpdateTimestamp": "2013-01-01T01:01:01.001Z" | |
}, | |
"SellerOrderAttributes": null, | |
"AmazonOrderReferenceId": "P01-0000000-0000000-000000", | |
"ExpirationTimestamp": "2013-01-01T01:01:01.001Z" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment