Created
June 7, 2012 19:50
-
-
Save VantivSDK/2891156 to your computer and use it in GitHub Desktop.
Python SDK- Litle Payment Full Lifecycle Example
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 litleSdkPython.litleOnlineRequest import * | |
| config = Configuration() | |
| config.setUser("User") | |
| config.setPassword("Pass") | |
| config.setMerchantId("123") | |
| config.setUrl("Sandbox") | |
| config.setProxy("") | |
| #Auth | |
| #Puts a hold on the fund | |
| auth = litleXmlFields.authorization() | |
| auth.amount = 10010 | |
| auth.orderId = "1" | |
| auth.orderSource = 'ecommerce' | |
| billtoaddress = litleXmlFields.contact() | |
| billtoaddress.name = "John Smith" | |
| billtoaddress.addressLine1 = "1 Main St." | |
| billtoaddress.city = "Burlington" | |
| billtoaddress.state = "MA" | |
| billtoaddress.zip = "01803-3747" | |
| billtoaddress.country = "USA" | |
| auth.billToAddress = billtoaddress | |
| card = litleXmlFields.cardType() | |
| card.type = 'VI' | |
| card.number = "4457010000000009" | |
| card.expDate = "0112" | |
| card.cardValidationNum = "349" | |
| auth.card = card | |
| litleXml = litleOnlineRequest(config) | |
| authResponse = litleXml.sendRequest(auth) | |
| #Auth Results | |
| print "Response: " + authResponse.response | |
| print "Message: " + authResponse.message | |
| print "LitleTransaction ID: " + str(authResponse.litleTxnId) | |
| #Capture | |
| #Captures the authorization and results in money movement | |
| capture = litleXmlFields.capture() | |
| capture.litleTxnId = authResponse.litleTxnId | |
| captureResponse = litleXml.sendRequest(capture) | |
| #Capture Results | |
| print "Capture Response: " + captureResponse.response | |
| print "Message: " + captureResponse.message | |
| print "LitleTransaction ID: " + str(captureResponse.litleTxnId) | |
| #Credit | |
| #Refund the customer | |
| credit = litleXmlFields.credit() | |
| credit.litleTxnId = captureResponse.litleTxnId | |
| creditResponse = litleXml.sendRequest(credit) | |
| #Credit Results | |
| print "Credit Response: " + creditResponse.response | |
| print "Message: " + creditResponse.message | |
| print "LitleTransaction ID: " + str(creditResponse.litleTxnId) | |
| #Void | |
| #Cancel the refund, note that a deposit can be Voided as well | |
| void = litleXmlFields.void() | |
| void.litleTxnId = creditResponse.litleTxnId | |
| voidResponse = litleXml.sendRequest(void) | |
| #Void Results | |
| print "Void Response: " + voidResponse.response | |
| print "Message: " + voidResponse.message | |
| print "LitleTransaction ID: " + str(voidResponse.litleTxnId) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment