def authorization_only_continued(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction transactionrequest.refTransId = "2245592542" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if response is not None: if response.messages.resultCode == "Ok": if hasattr(response.transactionResponse, 'messages') == True: print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId) print ("Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID) print ('Transaction Response Code: %s' % response.transactionResponse.responseCode) print ('Message Code: %s' % response.transactionResponse.messages.message[0].code) print ('Description: %s' % response.transactionResponse.messages.message[0].description) else: print ('Failed Transaction.') if hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Failed Transaction.') if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Error Code: %s' % response.messages.message[0]['code'].text) print ('Error message: %s' % response.messages.message[0]['text'].text) else: print ('Null Response.') return response
def authorization_only_continued(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction transactionrequest.refTransId = "2245592542" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if response is not None: if response.messages.resultCode == "Ok": if hasattr(response.transactionResponse, 'messages') == True: print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId); print ("Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID) print ('Transaction Response Code: %s' % response.transactionResponse.responseCode); print ('Message Code: %s' % response.transactionResponse.messages.message[0].code); print ('Description: %s' % response.transactionResponse.messages.message[0].description); else: print ('Failed Transaction.'); if hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); else: print ('Failed Transaction.'); if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); else: print ('Error Code: %s' % response.messages.message[0]['code'].text); print ('Error message: %s' % response.messages.message[0]['text'].text); else: print ('Null Response.'); return response
def credit(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.refundTransaction transactionrequest.refTransId = "2241762126" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if response is not None: if response.messages.resultCode == "Ok": if hasattr(response.transactionResponse, "messages") == True: print("Successfully created transaction with Transaction ID: %s" % response.transactionResponse.transId) print("Transaction Response Code: %s" % response.transactionResponse.responseCode) print("Message Code: %s" % response.transactionResponse.messages.message[0].code) print("Description: %s" % response.transactionResponse.messages.message[0].description) else: print("Failed Transaction.") if hasattr(response.transactionResponse, "errors") == True: print("Error Code: %s" % str(response.transactionResponse.errors.error[0].errorCode)) print("Error message: %s" % response.transactionResponse.errors.error[0].errorText) else: print("Failed Transaction.") if ( hasattr(response, "transactionResponse") == True and hasattr(response.transactionResponse, "errors") == True ): print("Error Code: %s" % str(response.transactionResponse.errors.error[0].errorCode)) print("Error message: %s" % response.transactionResponse.errors.error[0].errorText) else: print("Error Code: %s" % response.messages.message[0]["code"].text) print("Error message: %s" % response.messages.message[0]["text"].text) else: print("Null Response.") return response
def authorization_and_capture_continued(refTransId, payerID): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.payerID = payerID payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureContinueTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if response is not None: if response.messages.resultCode == "Ok": if hasattr(response.transactionResponse, 'messages') == True: print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId) print ("Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID) print ('Transaction Response Code: %s' % response.transactionResponse.responseCode) print ('Message Code: %s' % response.transactionResponse.messages.message[0].code) print ('Description: %s' % response.transactionResponse.messages.message[0].description) else: print ('Failed Transaction.') if hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Failed Transaction.') if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Error Code: %s' % response.messages.message[0]['code'].text) print ('Error message: %s' % response.messages.message[0]['text'].text) else: print ('Null Response.') return response
def void(refTransId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.voidTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if response is not None: if response.messages.resultCode == "Ok": if hasattr(response.transactionResponse, 'messages') == True: print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId) print ('Transaction Response Code: %s' % response.transactionResponse.responseCode) print ('Message Code: %s' % response.transactionResponse.messages.message[0].code) print ('Description: %s' % response.transactionResponse.messages.message[0].description) else: print ('Failed Transaction.') if hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Failed Transaction.') if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)) print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText) else: print ('Error Code: %s' % response.messages.message[0]['code'].text) print ('Error message: %s' % response.messages.message[0]['text'].text) else: print ('Null Response.') return response
def authorization_only_continued(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction transactionrequest.refTransId = "2245592542" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text if (response.transactionResponse.responseCode == "1"): print "Description : %s " % response.transactionResponse.messages.message[ 0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def authorization_only_continued(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction transactionrequest.refTransId = "2245592542" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def prior_authorization_capture(refTransId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.priorAuthCaptureTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0]['code'].text print "Message text : %s" % response.messages.message[0]['text'].text print "Auth code : %s " % response.transactionResponse.authCode if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0]['code'].text print "Message text : %s" % response.messages.message[0]['text'].text return response
def authorization_and_capture_continue(refTransId, payerID): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.payerID = payerID payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureContinueTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text if (response.transactionResponse.responseCode == "1"): print "Description : %s " % response.transactionResponse.messages.message[ 0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def authorization_and_capture_continue(refTransId, payerID): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.payerID = payerID payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureContinueTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0]['code'].text print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0]['code'].text print "Message text : %s" % response.messages.message[0]['text'].text return response
def authorization_only(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.amount = Decimal('55.00') transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyTransaction transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text print "Secure acceptance URL : %s " % response.transactionResponse.secureAcceptance.SecureAcceptanceUrl print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def authorization_only(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.amount = Decimal('55.00') transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyTransaction transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text print "Secure acceptance URL : %s " % response.transactionResponse.secureAcceptance.SecureAcceptanceUrl print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def void(refTransId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.voidTransaction transactionrequest.refTransId = refTransId transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text if (response.transactionResponse.responseCode == "1"): print "Transaction ID : %s " % response.transactionResponse.transId print "Description : %s " % response.transactionResponse.messages.message[ 0].description else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def credit(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey paypal = apicontractsv1.payPalType() payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.refundTransaction transactionrequest.refTransId = "2241762126" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print "SUCCESS" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text if (response.transactionResponse.responseCode == "1" ): print "Transaction ID : %s " % response.transactionResponse.transId print "Description : %s " % response.transactionResponse.messages.message[0].description else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * from decimal import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.priorAuthCaptureTransaction transactionrequest.refTransId = "2245591700" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse()
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * from decimal import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' paypal = apicontractsv1.payPalType() paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" paypal.payerID = "LM6NCLZ5RAKBY" payment = apicontractsv1.paymentType() payment.payPal = paypal transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction transactionrequest.refTransId = "2245592542" transactionrequest.payment = payment request = apicontractsv1.createTransactionRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.transactionRequest = transactionrequest controller = createTransactionController(request) controller.execute() response = controller.getresponse()