Page 3 of 3 First 123
  • Jump to page:
    #31
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    Originally Posted by ManiacDan
    createCustomerProfileTransactionRequest is obviously printing those extra tags.
    Ok for clarity I need to post the entire code again to see the input and output. So how would I get the result I need without createCustomerProfileTransactionRequest? I need this to be accepted by Authorize.net API.

    This is how I have it:

    PHP Code:
    $xml = new AuthnetXML(AUTHNET_LOGINAUTHNET_TRANSKEYAuthnetXML::USE_DEVELOPMENT_SERVER);
    $xml->createCustomerProfileTransactionRequest(array(
            
    'transaction' => array(
                
    'profileTransAuthCapture' => array(
                    
    'amount' => $Order->Cart->Totals->total,
                     
    'tax' => array(
                    
    'amount' => '1.00',
                        
    'name' => 'state sales tax',
                        
    'description' => 'Desc state sales tax'
               
    ),
            
                 
    'lineItems' => array(  //this list needs to be dynamic
                        
    => array(
                            
    'itemId' => '1',
                            
    'name' => 'widget 5',
                            
    'description' => 'Description of widget 5',
                            
    'quantity' => '2',
                            
    'unitPrice' => '5.00'
                        
    ),
                        
    => array(
                            
    'itemId' => '2',
                            
    'name' => 'widget 6',
                            
    'description' => 'Description of widget 6',
                            
    'quantity' => '1',
                            
    'unitPrice' => '8.00'
                        
    )
                    ),
            
                    
    'customerProfileId' => '129',
                    
    'customerPaymentProfileId' => '119',
                    
    'customerShippingAddressId' => '120',
                    
    'order' => array(
                        
    'invoiceNumber' => 'INV00001',
                        
    'description' => 'description of transaction',
                        
    'purchaseOrderNumber' => 'PON00001'
                    
    ),
                    
    'taxExempt' => 'false',
                    
    'recurringBilling' => 'false',
                    
    'cardCode' => '000'
                
    )
                
          ),
          
     ) ); 
    And the XML needs to be in this format. Everything is fine except for that lineItems section.

    PHP Code:
    <createCustomerProfileTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <
    merchantAuthentication>
    <
    name>xxx</name>
    <
    transactionKey>xxx</transactionKey>
    </
    merchantAuthentication>
    <
    transaction>
    <
    profileTransAuthCapture>
    <
    amount>10.95</amount>
    <
    tax>
    <
    amount>1.00</amount>
    <
    name>state sales tax</name>
    <
    description>descstate sales tax</description>
    </
    tax>
    <
    lineItems>
    <
    lineItem>
    <
    itemId>1</itemId>
    <
    name>widget 5</name>
    <
    description>desc of widgt 5</description>
    <
    quantity>2</quantity>
    <
    unitPrice>5.00</unitPrice>
    </
    lineItem>
    <
    lineItem>
    <
    itemId>2</itemId>
    <
    name>widget 6</name>
    <
    description>desccrition widget 6</description>
    <
    quantity>1</quantity>
    <
    unitPrice>8.00</unitPrice>
    </
    lineItem>
    </
    lineItems>
    <
    customerProfileId>129</customerProfileId>
    <
    customerPaymentProfileId>119</customerPaymentProfileId>
    <
    customerShippingAddressId>120</customerShippingAddressId>
    <
    order>
    <
    invoiceNumber>INV000001</invoiceNumber>
    <
    description>description of transaction</description>
    <
    purchaseOrderNumber>PONUM000001</purchaseOrderNumber>
    </
    order>
    <
    taxExempt>false</taxExempt>
    <
    recurringBilling>false</recurringBilling>
    <
    cardCode>000</cardCode>
    </
    profileTransAuthCapture>
    </
    transaction>
    <
    extraOptions>&lt;![CDATA[x_customer_ip=100.0.0.1]]&gt;</extraOptions>
    </
    createCustomerProfileTransactionRequest
  2. #32
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    No, what I'm saying is, createCustomerProfileTransactionRequest is wrong. There is no way for you to fix your code, because it is not your code which is wrong. That function is printing extra tags. Go into that function and fix it.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #33
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    createCustomerProfileTransactionRequest resides with Authrize.net I don't have that in my folders or on my server.
  6. #34
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Then unless I'm reading this whole page wrong, you're screwed. You've followed their instructions perfect (presumably, they do have an online code repository which includes PHP) and you pass a valid array to their function, at which point their function spits out data they do not accept.

    Are you really including a remote PHP page in your stack? That seems really insecure and not something a payment gateway would encourage.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  8. #35
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    They provide source code and show you how to format your XML to send the data to Authorize.net. But I have to come up with my own solution to take the data from my store to send. Sure it easy to hard code some values and send the XML but that is not the end solution.
  10. #36
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Ok then, if you have possession of the source code, I'll go back to my last statement:

    No, what I'm saying is, createCustomerProfileTransactionRequest is wrong. There is no way for you to fix your code, because it is not your code which is wrong. That function is printing extra tags. Go into that function and fix it.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #37
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    Do you see anything from previous post#26 that could cause this?
    This is where I got my code from https://github.com/stymiee/Authorize...uthCapture.php
    Last edited by mallen; March 19th, 2013 at 12:36 PM.
  14. #38
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    The nature of these forums is you have to post something everyday or your post gets moved down.
  16. #39
  17. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Pushing your thread to the top of the list over and over is actually a violation of the forum rules.

    And for the third and final time: the function which outputs your XML is incorrect, or you are not using it properly. That is all I'm ever going to say. You have what appears to be a well-formed array, and you pass that to an XML generator, and you get back weird XML with extra tags. Go fix that.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  18. #40
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    392
    Rep Power
    76
    No I didn't mean I was bumping my topic to the top. I could have easy posted another incorrect piece of code and got the same reply and moved it to the top.

    I should be the one that is frustrated not you. You don't have to reply to questions if you don't want to. Let someone else respond. I never understood on this forum and others why some users will respond over and over and get frustrated with the original poster. We are not all experts. I'm just here trying to learn.
    Last edited by mallen; March 20th, 2013 at 10:45 AM. Reason: spelling
  20. #41
  21. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,122
    Rep Power
    9398
    PHP Code:
    $xml = new AuthnetXML(AUTHNET_LOGINAUTHNET_TRANSKEYAuthnetXML::USE_DEVELOPMENT_SERVER); 
    $xml->createCustomerProfileTransactionRequest(array( 
            
    'transaction' => array( 
                
    'profileTransAuthCapture' => array( 
                    
    'amount' => $Order->Cart->Totals->total
                     
    'tax' => array( 
                    
    'amount' => '1.00'
                        
    'name' => 'state sales tax'
                        
    'description' => 'Desc state sales tax' 
               
    ), 
             
                 
    'lineItems' => array(  //this list needs to be dynamic 
                        
    => array( 
                            
    'itemId' => '1'
                            
    'name' => 'widget 5'
                            
    'description' => 'Description of widget 5'
                            
    'quantity' => '2'
                            
    'unitPrice' => '5.00' 
                        
    ), 
                        
    => array( 
                            
    'itemId' => '2'
                            
    'name' => 'widget 6'
                            
    'description' => 'Description of widget 6'
                            
    'quantity' => '1'
                            
    'unitPrice' => '8.00' 
                        

                    ), 
             
                    
    'customerProfileId' => '129'
                    
    'customerPaymentProfileId' => '119'
                    
    'customerShippingAddressId' => '120'
                    
    'order' => array( 
                        
    'invoiceNumber' => 'INV00001'
                        
    'description' => 'description of transaction'
                        
    'purchaseOrderNumber' => 'PON00001' 
                    
    ), 
                    
    'taxExempt' => 'false'
                    
    'recurringBilling' => 'false'
                    
    'cardCode' => '000' 
                

                 
          ), 
           
     ) ); 
    That's really your actual code? Because nowhere in there nor in the AuthnetXML class is there a mention of "lineItem". ptr's code has that and would output the XML you've shown, and the only thing (at a casual glance) you would need to change is remove the lineItems=>array part.

    FYI other people not familiar with CIM the lineItems goes like
    Code:
    <lineItems> 
        <itemId>1</itemId> 
        <name>widget 5</name> 
        <description>desc of widgt 5</description> 
        <quantity>2</quantity> 
        <unitPrice>5.00</unitPrice> 
    </lineItems> 
    <lineItems> 
        <itemId>2</itemId> 
        <name>widget 6</name> 
        <description>desccrition widget 6</description> 
        <quantity>1</quantity> 
        <unitPrice>8.00</unitPrice> 
    </lineItems>
  22. #42
  23. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,549
    Rep Power
    2337
    Because nowhere in there nor in the AuthnetXML class is there a mention of "lineItem
    There is, according to what he posted a link to.

    Code:
    <lineItems>
     <lineItem>
      <itemId>1</itemId>
      <name>vase</name>
      <description>Cannes logo</description>
      <quantity>18</quantity>
      <unitPrice>45.00</unitPrice>
     </lineItem>
     <lineItem>
      <itemId>2</itemId>
      <name>desk</name>
      <description>Big Desk</description>
      <quantity>10</quantity>
      <unitPrice>85.00</unitPrice>
     </lineItem>
    </lineItems>
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  24. #43
  25. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,122
    Rep Power
    9398
    Right. I meant in the code that is generating that.
  26. #44
  27. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    That's why I've continuously pointed him at this magical black-box builder function, because he's saying it's automatically generating singular words out of plurals, and then repeating the pluralized tags too often, and many other things.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
Page 3 of 3 First 123
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo