From 43d41b20c7bb48803574b9f1d34f011489ddf27a Mon Sep 17 00:00:00 2001 From: zhaque Date: Thu, 26 Nov 2015 22:21:08 +0530 Subject: [PATCH] Added following sample codes: 1. ApplePayTransactions/create-an-apple-pay-transaction 2. PaymentTransactions/charge-tokenized-credit-card 3. PaypalExpressCheckout/authorization-and-capture-continue 4. PaypalExpressCheckout/authorization-and-capture 5. PaypalExpressCheckout/authorization-only-continued 6. PaypalExpressCheckout/authorization-only 7. PaypalExpressCheckout/credit 8. PaypalExpressCheckout/get-details 9. PaypalExpressCheckout/prior-authorization-capture 10. PaypalExpressCheckout/void.py 11. RecurringBilling/cancel-subscription 12. RecurringBilling/get-list-of-subscription.py 13. RecurringBilling/update-subscription.py Signed off : Zeeshanul Haque --- .../create-an-apple-pay-transaction.py | 40 +++++++++++++++++ .../charge-tokenized-credit-card.py | 40 +++++++++++++++++ .../authorization-and-capture-continue.py | 41 ++++++++++++++++++ .../authorization-and-capture.py | 40 +++++++++++++++++ .../authorization-only-continued.py | 43 +++++++++++++++++++ PaypalExpressCheckout/authorization-only.py | 40 +++++++++++++++++ PaypalExpressCheckout/credit.py | 39 +++++++++++++++++ PaypalExpressCheckout/get-details.py | 33 ++++++++++++++ .../prior-authorization-capture.py | 43 +++++++++++++++++++ PaypalExpressCheckout/void.py | 39 +++++++++++++++++ RecurringBilling/cancel-subscription.py | 25 +++++++++++ RecurringBilling/get-list-of-subscription.py | 36 ++++++++++++++++ RecurringBilling/update-subscription.py | 36 ++++++++++++++++ 13 files changed, 495 insertions(+) create mode 100644 ApplePayTransactions/create-an-apple-pay-transaction.py create mode 100644 PaymentTransactions/charge-tokenized-credit-card.py create mode 100644 PaypalExpressCheckout/authorization-and-capture-continue.py create mode 100644 PaypalExpressCheckout/authorization-and-capture.py create mode 100644 PaypalExpressCheckout/authorization-only-continued.py create mode 100644 PaypalExpressCheckout/authorization-only.py create mode 100644 PaypalExpressCheckout/credit.py create mode 100644 PaypalExpressCheckout/get-details.py create mode 100644 PaypalExpressCheckout/prior-authorization-capture.py create mode 100644 PaypalExpressCheckout/void.py create mode 100644 RecurringBilling/cancel-subscription.py create mode 100644 RecurringBilling/get-list-of-subscription.py create mode 100644 RecurringBilling/update-subscription.py diff --git a/ApplePayTransactions/create-an-apple-pay-transaction.py b/ApplePayTransactions/create-an-apple-pay-transaction.py new file mode 100644 index 0000000..97797b3 --- /dev/null +++ b/ApplePayTransactions/create-an-apple-pay-transaction.py @@ -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 = "eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2am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zlrSmsyMzJnU0U3V2xDdEhiZkxTS2Z1U2dRWDhLWFFZdVpMazJScjYzTjhBcFhzWHdCTDNjSjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=" + +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 diff --git a/PaymentTransactions/charge-tokenized-credit-card.py b/PaymentTransactions/charge-tokenized-credit-card.py new file mode 100644 index 0000000..ab9f63e --- /dev/null +++ b/PaymentTransactions/charge-tokenized-credit-card.py @@ -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 diff --git a/PaypalExpressCheckout/authorization-and-capture-continue.py b/PaypalExpressCheckout/authorization-and-capture-continue.py new file mode 100644 index 0000000..56c6ff2 --- /dev/null +++ b/PaypalExpressCheckout/authorization-and-capture-continue.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/authorization-and-capture.py b/PaypalExpressCheckout/authorization-and-capture.py new file mode 100644 index 0000000..067583d --- /dev/null +++ b/PaypalExpressCheckout/authorization-and-capture.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/authorization-only-continued.py b/PaypalExpressCheckout/authorization-only-continued.py new file mode 100644 index 0000000..64cc689 --- /dev/null +++ b/PaypalExpressCheckout/authorization-only-continued.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/authorization-only.py b/PaypalExpressCheckout/authorization-only.py new file mode 100644 index 0000000..e22b6bb --- /dev/null +++ b/PaypalExpressCheckout/authorization-only.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/credit.py b/PaypalExpressCheckout/credit.py new file mode 100644 index 0000000..8fd72ec --- /dev/null +++ b/PaypalExpressCheckout/credit.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/get-details.py b/PaypalExpressCheckout/get-details.py new file mode 100644 index 0000000..a8e995f --- /dev/null +++ b/PaypalExpressCheckout/get-details.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/prior-authorization-capture.py b/PaypalExpressCheckout/prior-authorization-capture.py new file mode 100644 index 0000000..c6d81bb --- /dev/null +++ b/PaypalExpressCheckout/prior-authorization-capture.py @@ -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 \ No newline at end of file diff --git a/PaypalExpressCheckout/void.py b/PaypalExpressCheckout/void.py new file mode 100644 index 0000000..338973c --- /dev/null +++ b/PaypalExpressCheckout/void.py @@ -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.voidTransaction +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 "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 \ No newline at end of file diff --git a/RecurringBilling/cancel-subscription.py b/RecurringBilling/cancel-subscription.py new file mode 100644 index 0000000..2919836 --- /dev/null +++ b/RecurringBilling/cancel-subscription.py @@ -0,0 +1,25 @@ +from authorizenet import apicontractsv1 +from authorizenet.apicontrollers import * + +merchantAuth = apicontractsv1.merchantAuthenticationType() +merchantAuth.name = '5KP3u95bQpv' +merchantAuth.transactionKey = '4Ktq966gC55GAX7S' + +request = apicontractsv1.ARBCancelSubscriptionRequest() +request.merchantAuthentication = merchantAuth +request.refId = "Sample" +request.subscriptionId = "2945617" + +controller = ARBCancelSubscriptionController(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 +else: + print "ERROR" + print "Message Code : %s" % response.messages.message[0].code + print "Message text : %s" % response.messages.message[0].text \ No newline at end of file diff --git a/RecurringBilling/get-list-of-subscription.py b/RecurringBilling/get-list-of-subscription.py new file mode 100644 index 0000000..124d65b --- /dev/null +++ b/RecurringBilling/get-list-of-subscription.py @@ -0,0 +1,36 @@ +from authorizenet import apicontractsv1 +from authorizenet.apicontrollers import * + +merchantAuth = apicontractsv1.merchantAuthenticationType() +merchantAuth.name = '5KP3u95bQpv' +merchantAuth.transactionKey = '4Ktq966gC55GAX7S' + +sorting = apicontractsv1.ARBGetSubscriptionListSorting() +sorting.orderBy = apicontractsv1.ARBGetSubscriptionListOrderFieldEnum.id +sorting.orderDescending = "false" + +paging = apicontractsv1.Paging() +paging.limit = 1000 +paging.offset = 1 + +request = apicontractsv1.ARBGetSubscriptionListRequest() +request.merchantAuthentication = merchantAuth +request.refId = "Sample" +request.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionInactive +request.sorting = sorting +request.paging = paging + +controller = ARBGetSubscriptionListController(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 "Total Number In Results : %s" % response.totalNumInResultSet +else: + print "ERROR" + print "Message Code : %s" % response.messages.message[0].code + print "Message text : %s" % response.messages.message[0].text \ No newline at end of file diff --git a/RecurringBilling/update-subscription.py b/RecurringBilling/update-subscription.py new file mode 100644 index 0000000..b90def0 --- /dev/null +++ b/RecurringBilling/update-subscription.py @@ -0,0 +1,36 @@ +from authorizenet import apicontractsv1 +from authorizenet.apicontrollers import * + +merchantAuth = apicontractsv1.merchantAuthenticationType() +merchantAuth.name = '5KP3u95bQpv' +merchantAuth.transactionKey = '4Ktq966gC55GAX7S' + +creditcard = apicontractsv1.creditCardType() +creditcard.cardNumber = "4111111111111111" +creditcard.expirationDate = "2020-12" + +payment = apicontractsv1.paymentType() +payment.creditCard = creditcard + +subscription = apicontractsv1.ARBSubscriptionType() +subscription.payment = payment + +request = apicontractsv1.ARBUpdateSubscriptionRequest() +request.merchantAuthentication = merchantAuth +request.refId = "Sample" +request.subscriptionId = "2945620" +request.subscription = subscription + +controller = ARBUpdateSubscriptionController(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 +else: + print "ERROR" + print "Message Code : %s" % response.messages.message[0].code + print "Message text : %s" % response.messages.message[0].text \ No newline at end of file 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