<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Switch to Production Mode (controller environment) in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Switch-to-Production-Mode-controller-environment/m-p/68354#M41584</link>
    <description>&lt;P&gt;I solved error. The way I fixed it was I changed the file constants.py to credentials.py and then I changed the variable to MY_CONSTANTS but you can change them to be credentials if you want.&lt;/P&gt;&lt;P&gt;If it does doesn't work at that point you could try to hard code it instead with createtransactioncontroller.setenvironment('&lt;A href="https://api2.authorize.net/xml/v1/request.api" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api2.authorize.net/xml/v1/request.api&lt;/A&gt;') but if you don't then leave it to be constants.PRODUCTION&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; createTransactionController&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;createtransactionrequest&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;setenvironment&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;constants&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;PRODUCTION&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="com"&gt;# or createtransactioncontroller.setenvironment('https://api2.authorize.net/xml/v1/request.api')&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I used a dictionary for my credentials(constants in your case) so mine looks a little different.&lt;/P&gt;&lt;PRE&gt;    &lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; imp
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; os
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; sys
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; importlib
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;constants &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; constants
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; apicontractsv1
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;apicontrollers &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; createTransactionController

    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;credentials &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS

&lt;/SPAN&gt;&lt;SPAN class="com"&gt;# retrieved from the constants file&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; apicontractsv1&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuthenticationType&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;name &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'apiLoginId'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;transactionKey &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'transactionKey'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I hope this helps anyone with the same issue.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 18:39:45 GMT</pubDate>
    <dc:creator>jessej917</dc:creator>
    <dc:date>2019-07-10T18:39:45Z</dc:date>
    <item>
      <title>Python Switch to Production Mode (controller environment)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Switch-to-Production-Mode-controller-environment/m-p/68340#M41573</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am trying to change from sandbox to production with Python and I keep getting this error.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Error Code: E00007

Error message: User authentication failed due to invalid authentication values.&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;My code was working correctly in the sandbox environment, but once I switched my apiLoginId and transactionKey to the production version, I am no longer able to make payments. These credentials are correct (which is the only issue offered by Authorize.net here: &lt;A href="https://developer.authorize.net/api/reference/responseCodes.html?code=e00007" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://developer.authorize.net/api/reference/responseCodes.html?code=e00007&lt;SPAN&gt;).&lt;SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am wondering if the issue is caused by the line: createtransactioncontroller.setenvironment(settings.PRODUCTION).&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;import imp

import os

import sys

import importlib

from authorizenet.constants import constants

from authorizenet import apicontractsv1

from authorizenet.apicontrollers import createTransactionController



from .constants import MY_CONSTANTS&amp;nbsp; #contains my apiLoginId and transactionKey



def charge_credit_card(amount, number, first_name, last_name, expire_month, expire_year, cvv_number, product_name, description, product_pk, user_pk, user_email):



&amp;nbsp;&amp;nbsp;&amp;nbsp;# Create a merchantAuthenticationType object with authentication details

&amp;nbsp;&amp;nbsp;&amp;nbsp;# retrieved from the constants file

&amp;nbsp;&amp;nbsp;&amp;nbsp;merchantAuth = apicontractsv1.merchantAuthenticationType()

&amp;nbsp;&amp;nbsp;&amp;nbsp;merchantAuth.name = MY_CONSTANTS['apiLoginId']

&amp;nbsp;&amp;nbsp;&amp;nbsp;merchantAuth.transactionKey = MY_CONSTANTS['transactionKey']



&amp;nbsp;&amp;nbsp;&amp;nbsp;.........



&amp;nbsp;&amp;nbsp;&amp;nbsp;# Assemble the complete transaction request

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactionrequest = apicontractsv1.createTransactionRequest()

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactionrequest.merchantAuthentication = merchantAuth

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactionrequest.refId = "MerchantID-0001"

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactionrequest.transactionRequest = transactionrequest

&amp;nbsp;&amp;nbsp;&amp;nbsp;# Create the controller

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactioncontroller = createTransactionController(

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactionrequest)

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactioncontroller.setenvironment(settings.PRODUCTION)

&amp;nbsp;&amp;nbsp;&amp;nbsp;createtransactioncontroller.execute()&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am having the same error as &lt;A href="https://stackoverflow.com/questions/56741738/how-to-pass-the-production-variable-to-authorize-net-api" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://stackoverflow.com/questions/56741738/how-to-pass-the-production-variable-to-authorize-net-api&lt;SPAN&gt;, but nobody was able to resolve their error either.&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone please tell me where the url goes or whatever is wrong with my code?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 23:30:37 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Switch-to-Production-Mode-controller-environment/m-p/68340#M41573</guid>
      <dc:creator>jessej917</dc:creator>
      <dc:date>2019-07-09T23:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python Switch to Production Mode (controller environment)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Switch-to-Production-Mode-controller-environment/m-p/68354#M41584</link>
      <description>&lt;P&gt;I solved error. The way I fixed it was I changed the file constants.py to credentials.py and then I changed the variable to MY_CONSTANTS but you can change them to be credentials if you want.&lt;/P&gt;&lt;P&gt;If it does doesn't work at that point you could try to hard code it instead with createtransactioncontroller.setenvironment('&lt;A href="https://api2.authorize.net/xml/v1/request.api" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api2.authorize.net/xml/v1/request.api&lt;/A&gt;') but if you don't then leave it to be constants.PRODUCTION&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; createTransactionController&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;createtransactionrequest&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;setenvironment&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;constants&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;PRODUCTION&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="com"&gt;# or createtransactioncontroller.setenvironment('https://api2.authorize.net/xml/v1/request.api')&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    createtransactioncontroller&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I used a dictionary for my credentials(constants in your case) so mine looks a little different.&lt;/P&gt;&lt;PRE&gt;    &lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; imp
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; os
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; sys
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; importlib
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;constants &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; constants
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; apicontractsv1
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; authorizenet&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;apicontrollers &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; createTransactionController

    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;from&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;credentials &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS

&lt;/SPAN&gt;&lt;SPAN class="com"&gt;# retrieved from the constants file&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; apicontractsv1&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuthenticationType&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;name &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'apiLoginId'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;merchantAuth&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;transactionKey &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; MY_CONSTANTS&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'transactionKey'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I hope this helps anyone with the same issue.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:39:45 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Switch-to-Production-Mode-controller-environment/m-p/68354#M41584</guid>
      <dc:creator>jessej917</dc:creator>
      <dc:date>2019-07-10T18:39:45Z</dc:date>
    </item>
  </channel>
</rss>

