<?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 Python - Can't create customer profile data in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/63741#M37790</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to find examples of how to do this, which I think should be&amp;nbsp;VERY simple to do but I am struggling. All I want to do is set the customer name to whatever they put as the account holder name in my form. In my reports there is a "customer" field that should show a name but it is blank right now. My question is, where do I set that in my code? It isn't clear to me how customer data is supposed to work so I've been trying different things. This code generates a profileResponse error (the payment transaction goes through fine). What else do I need to add to capture the data and have it show in my transaction reports?&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;profileResponse&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;messages&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;resultCode&amp;gt;Error&amp;lt;/resultCode&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;message&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;code&amp;gt;E00039&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;text&amp;gt;A duplicate record with ID 1504872533 already exists.&amp;lt;/text&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/message&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/messages&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/profileResponse&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;merchantAuth = apicontractsv1.merchantAuthenticationType()&lt;BR /&gt;merchantAuth.name = settings.API_LOGIN_ID&lt;BR /&gt;merchantAuth.transactionKey = settings.TRANSACTION_KEY&lt;BR /&gt;creditCard = apicontractsv1.creditCardType()&lt;BR /&gt;creditCard.cardNumber = number&lt;BR /&gt;creditCard.expirationDate = expiration&lt;BR /&gt;creditCard.cardCode = card_code&lt;BR /&gt;&lt;BR /&gt;line_items = []&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;line &lt;SPAN&gt;in &lt;/SPAN&gt;items:&lt;BR /&gt;    line_item = apicontractsv1.lineItemType()&lt;BR /&gt;    line_item.quantity = &lt;SPAN&gt;1&lt;BR /&gt;&lt;/SPAN&gt;    line_item.itemId = line[&lt;SPAN&gt;'itemId'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.unitPrice = line[&lt;SPAN&gt;'amount'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.description = line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.name = line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;]&lt;BR /&gt;    line_items.append(line_item)&lt;BR /&gt;    &lt;SPAN&gt;print&lt;/SPAN&gt;(line[&lt;SPAN&gt;'itemId'&lt;/SPAN&gt;]&lt;SPAN&gt;, &lt;/SPAN&gt;line[&lt;SPAN&gt;'amount'&lt;/SPAN&gt;]&lt;SPAN&gt;, &lt;/SPAN&gt;line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;order = apicontractsv1.orderType()&lt;BR /&gt;order.description = description&lt;BR /&gt;order.invoiceNumber = invoice_number&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Set the customer's identifying information&lt;BR /&gt;&lt;/SPAN&gt;customerData = apicontractsv1.customerDataType()&lt;BR /&gt;customerData.type = &lt;SPAN&gt;"individual"&lt;BR /&gt;&lt;/SPAN&gt;customerData.id = &lt;SPAN&gt;str&lt;/SPAN&gt;(family.family_id)&lt;BR /&gt;customerData.email = family.user.email&lt;BR /&gt;&lt;BR /&gt;createcustomerprofile = apicontractsv1.customerProfilePaymentType()&lt;BR /&gt;createcustomerprofile.createProfile = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;payment = apicontractsv1.paymentType()&lt;BR /&gt;payment.creditCard = creditCard&lt;BR /&gt;&lt;BR /&gt;transactionrequest = apicontractsv1.transactionRequestType()&lt;BR /&gt;transactionrequest.transactionType = &lt;SPAN&gt;"authCaptureTransaction"&lt;BR /&gt;&lt;/SPAN&gt;transactionrequest.amount = amount&lt;BR /&gt;transactionrequest.payment = payment&lt;BR /&gt;transactionrequest.profile = createcustomerprofile&lt;BR /&gt;transactionrequest.order = order&lt;BR /&gt;transactionrequest.customer = customerData&lt;BR /&gt;&lt;SPAN&gt;# transactionrequest.billTo = customerAddress&lt;BR /&gt;&lt;/SPAN&gt;transactionrequest.lineItems = apicontractsv1.ArrayOfLineItem(*line_items)&lt;BR /&gt;&lt;BR /&gt;createtransactionrequest = apicontractsv1.createTransactionRequest()&lt;BR /&gt;createtransactionrequest.merchantAuthentication = merchantAuth&lt;BR /&gt;createtransactionrequest.refId = &lt;SPAN&gt;"MerchantID-0001"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;createtransactionrequest.transactionRequest = transactionrequest&lt;BR /&gt;createtransactioncontroller = createTransactionController(createtransactionrequest)&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jul 2018 05:17:54 GMT</pubDate>
    <dc:creator>mattxbart1</dc:creator>
    <dc:date>2018-07-18T05:17:54Z</dc:date>
    <item>
      <title>Python - Can't create customer profile data</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/63741#M37790</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to find examples of how to do this, which I think should be&amp;nbsp;VERY simple to do but I am struggling. All I want to do is set the customer name to whatever they put as the account holder name in my form. In my reports there is a "customer" field that should show a name but it is blank right now. My question is, where do I set that in my code? It isn't clear to me how customer data is supposed to work so I've been trying different things. This code generates a profileResponse error (the payment transaction goes through fine). What else do I need to add to capture the data and have it show in my transaction reports?&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;profileResponse&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;messages&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;resultCode&amp;gt;Error&amp;lt;/resultCode&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;message&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;code&amp;gt;E00039&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;text&amp;gt;A duplicate record with ID 1504872533 already exists.&amp;lt;/text&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/message&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/messages&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;lt;/profileResponse&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;merchantAuth = apicontractsv1.merchantAuthenticationType()&lt;BR /&gt;merchantAuth.name = settings.API_LOGIN_ID&lt;BR /&gt;merchantAuth.transactionKey = settings.TRANSACTION_KEY&lt;BR /&gt;creditCard = apicontractsv1.creditCardType()&lt;BR /&gt;creditCard.cardNumber = number&lt;BR /&gt;creditCard.expirationDate = expiration&lt;BR /&gt;creditCard.cardCode = card_code&lt;BR /&gt;&lt;BR /&gt;line_items = []&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;line &lt;SPAN&gt;in &lt;/SPAN&gt;items:&lt;BR /&gt;    line_item = apicontractsv1.lineItemType()&lt;BR /&gt;    line_item.quantity = &lt;SPAN&gt;1&lt;BR /&gt;&lt;/SPAN&gt;    line_item.itemId = line[&lt;SPAN&gt;'itemId'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.unitPrice = line[&lt;SPAN&gt;'amount'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.description = line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;]&lt;BR /&gt;    line_item.name = line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;]&lt;BR /&gt;    line_items.append(line_item)&lt;BR /&gt;    &lt;SPAN&gt;print&lt;/SPAN&gt;(line[&lt;SPAN&gt;'itemId'&lt;/SPAN&gt;]&lt;SPAN&gt;, &lt;/SPAN&gt;line[&lt;SPAN&gt;'amount'&lt;/SPAN&gt;]&lt;SPAN&gt;, &lt;/SPAN&gt;line[&lt;SPAN&gt;'description'&lt;/SPAN&gt;])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;order = apicontractsv1.orderType()&lt;BR /&gt;order.description = description&lt;BR /&gt;order.invoiceNumber = invoice_number&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Set the customer's identifying information&lt;BR /&gt;&lt;/SPAN&gt;customerData = apicontractsv1.customerDataType()&lt;BR /&gt;customerData.type = &lt;SPAN&gt;"individual"&lt;BR /&gt;&lt;/SPAN&gt;customerData.id = &lt;SPAN&gt;str&lt;/SPAN&gt;(family.family_id)&lt;BR /&gt;customerData.email = family.user.email&lt;BR /&gt;&lt;BR /&gt;createcustomerprofile = apicontractsv1.customerProfilePaymentType()&lt;BR /&gt;createcustomerprofile.createProfile = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;payment = apicontractsv1.paymentType()&lt;BR /&gt;payment.creditCard = creditCard&lt;BR /&gt;&lt;BR /&gt;transactionrequest = apicontractsv1.transactionRequestType()&lt;BR /&gt;transactionrequest.transactionType = &lt;SPAN&gt;"authCaptureTransaction"&lt;BR /&gt;&lt;/SPAN&gt;transactionrequest.amount = amount&lt;BR /&gt;transactionrequest.payment = payment&lt;BR /&gt;transactionrequest.profile = createcustomerprofile&lt;BR /&gt;transactionrequest.order = order&lt;BR /&gt;transactionrequest.customer = customerData&lt;BR /&gt;&lt;SPAN&gt;# transactionrequest.billTo = customerAddress&lt;BR /&gt;&lt;/SPAN&gt;transactionrequest.lineItems = apicontractsv1.ArrayOfLineItem(*line_items)&lt;BR /&gt;&lt;BR /&gt;createtransactionrequest = apicontractsv1.createTransactionRequest()&lt;BR /&gt;createtransactionrequest.merchantAuthentication = merchantAuth&lt;BR /&gt;createtransactionrequest.refId = &lt;SPAN&gt;"MerchantID-0001"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;createtransactionrequest.transactionRequest = transactionrequest&lt;BR /&gt;createtransactioncontroller = createTransactionController(createtransactionrequest)&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 05:17:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/63741#M37790</guid>
      <dc:creator>mattxbart1</dc:creator>
      <dc:date>2018-07-18T05:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Can't create customer profile data</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/64222#M38174</link>
      <description>&lt;P&gt;3,158 views and no response?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Aug 2018 15:59:12 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/64222#M38174</guid>
      <dc:creator>mattxbart1</dc:creator>
      <dc:date>2018-08-18T15:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Can't create customer profile data</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/64231#M38182</link>
      <description>&lt;P&gt;To map the account holder's name to an API field, have you tried using the billTo firstName and lastName fields?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier,monospace"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; billto&lt;/EM&gt;&lt;SPAN&gt;.firstName&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;John&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier,monospace"&gt;&lt;SPAN class="pl-s"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; billto&lt;/EM&gt;&lt;SPAN&gt;.lastName&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;Smith&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;These get mapped to the paymentProfile object.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;&lt;A href="https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;Authorize.Net has two levels of profiles. There's a parent "customer profile", which has ID, email and description. Each customer profile can have associated "payment profiles" (with billing information including accountholder name) and "shipping profiles" (with shipping information).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;When you pass just the createProfile flag in your transaction, as you are doing, it attempts to create a new Customer Profile and add the associated billing/shipping information to payment and shipping profiles under that Customer Profile. For the Customer Profile to be created successfully, at least one of ID, email or description has to be unique; I presume this is not the case in your transaction.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier,monospace"&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;&amp;lt;/payment&amp;gt;&lt;BR /&gt;&amp;lt;profile&amp;gt;&lt;BR /&gt;&amp;lt;createProfile&amp;gt;true&amp;lt;/createProfile&amp;gt;&lt;BR /&gt;&amp;lt;/profile&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier,monospace"&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;&amp;lt;customer&amp;gt;&lt;BR /&gt;&amp;lt;id&amp;gt;99999456654&amp;lt;/id&amp;gt;&lt;BR /&gt;&amp;lt;/customer&amp;gt;&lt;BR /&gt;&amp;lt;billTo&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;If you want to add a payment/shipping profile to an existing Customer Profile (e.g. when it's the same customer using a new payment method or shipping address), you have to not just specify the createProfile field in the transaction but also the customerProfileId; this lets the system know that the customer profile is existing, and it just needs to create the payment/shipping profiles and add them to that particular customer profile. Also, make sure you don't again include the customer fields (ID, email, description) in this transaction.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier,monospace"&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;&amp;lt;/payment&amp;gt;&lt;BR /&gt;&amp;lt;profile&amp;gt;&lt;BR /&gt;&amp;lt;createProfile&amp;gt;true&amp;lt;/createProfile&amp;gt;&lt;BR /&gt;&amp;lt;customerProfileId&amp;gt;1915171911&amp;lt;/customerProfileId&amp;gt;&lt;BR /&gt;&amp;lt;/profile&amp;gt;&lt;BR /&gt;&amp;lt;billTo&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;Hope this answers both your questions.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 07:12:13 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Python-Can-t-create-customer-profile-data/m-p/64231#M38182</guid>
      <dc:creator>gmokhasi</dc:creator>
      <dc:date>2018-08-20T07:12:13Z</dc:date>
    </item>
  </channel>
</rss>

