Skip to content

Added following sample codes: #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ApplePayTransactions/create-an-apple-pay-transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

opaquedata = apicontractsv1.opaqueDataType()
opaquedata.dataDescriptor = "COMMON.APPLE.INAPP.PAYMENT"
opaquedata.dataValue = "eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzlt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9nZjlMTFU4NFRId05SbnN2VjNQcnY3UlRZODFncTBkdEM4elljQWFBa0NISUkzeXFNbko0QU91NkVPVzlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0="

paymentOne = apicontractsv1.paymentType()
paymentOne.opaqueData = opaquedata

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
transactionrequest.amount = Decimal('151')
transactionrequest.payment = paymentOne

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 "AUTH Code : %s" % response.authCode
print "Transaction ID : %s" % response.transId
else:
print "ERROR"
print "Message Code : %s" % response.messages.message[0].code
print "Message text : %s" % response.messages.message[0].text
40 changes: 40 additions & 0 deletions PaymentTransactions/charge-tokenized-credit-card.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

creditCard = apicontractsv1.creditCardType()
creditCard.cardNumber = "4111111111111111"
creditCard.expirationDate = "2020-12"
creditCard.cryptogram = "EjRWeJASNFZ4kBI0VniQEjRWeJA="

payment = apicontractsv1.paymentType()
payment.creditCard = creditCard

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = "authCaptureTransaction"
transactionrequest.amount = Decimal ('1.5')
transactionrequest.payment = payment

createtransactionrequest = apicontractsv1.createTransactionRequest()
createtransactionrequest.merchantAuthentication = merchantAuth
createtransactionrequest.refId = "MerchantID-0001"
createtransactionrequest.transactionRequest = transactionrequest

createtransactioncontroller = createTransactionController(createtransactionrequest)
createtransactioncontroller.execute()

response = createtransactioncontroller.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 "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
41 changes: 41 additions & 0 deletions PaypalExpressCheckout/authorization-and-capture-continue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

paypal = apicontractsv1.payPalType()
paypal.payerID = "LM6NCLZ5RAKBY"

payment = apicontractsv1.paymentType()
payment.payPal = paypal

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureContinueTransaction
transactionrequest.refTransId = "2245589256"
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
40 changes: 40 additions & 0 deletions PaypalExpressCheckout/authorization-and-capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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"

payment = apicontractsv1.paymentType()
payment.payPal = paypal

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.amount = Decimal('50.00')
transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
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
43 changes: 43 additions & 0 deletions PaypalExpressCheckout/authorization-only-continued.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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()

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
40 changes: 40 additions & 0 deletions PaypalExpressCheckout/authorization-only.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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"

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
39 changes: 39 additions & 0 deletions PaypalExpressCheckout/credit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

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
33 changes: 33 additions & 0 deletions PaypalExpressCheckout/get-details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.getDetailsTransaction
transactionrequest.refTransId = "2245592542"

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 "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
43 changes: 43 additions & 0 deletions PaypalExpressCheckout/prior-authorization-capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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()

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 "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
print "Message text : %s" % response.messages.message[0].text
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy