Posts: 11
Registered: ‎08-25-2014

CIM java code for charging an existing customer profile

I've got my code so that I can create customer profiles and payment profiles, but I'm running into a wall when trying to build the code to be able to charge one of those customer profiles.

I've coded to the code as such:

// Create an auth capture txn request
net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(TransactionType.CREATE_CUSTOMER_PROFILE_TRANSACTION);

//transaction.setCustomerShippingAddressId(customerShippingAddressId);  // not adding a shipping address


Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);


which produces this xml:

<?xml version="1.0"?>
<createCustomerProfileTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">

 and when that is posted this error comes back:

E00003:The element 'profileTransAuthCapture' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
has invalid child element 'customerProfileId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
List of possible elements expected: 'amount' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

I've got the same code basically that is in the unit test code, So what's wrong with this?  

Why doesn't this work?  And what do I have to change to make it work?


Posts: 4,525
Registered: ‎03-08-2010

Re: CIM java code for charging an existing customer profile

Missing an amount


doc in here

Posts: 11
Registered: ‎08-25-2014

Re: CIM java code for charging an existing customer profile

[ Edited ]

Thank you for your response.  I've read through the doc and the code and obviously the error and your post.  I still don't see anything that explains why profileTransAuthCapture doesn't like the customerProfileId child element.  Also if I'm missing the amount, then how/where do I add it?  I'm using JAVA so I'm not directly manipulating the XML and there for I can't just add in a tag.  (I wish I could, this would be easier).

To me it looks like the library is not working as it should.

Maybe I need to use the Order object?  Is there example Java code somewhere for this?  Nothing in the example code I can find shows how to charge an existing Customer Profile.

Posts: 4,525
Registered: ‎03-08-2010

Re: CIM java code for charging an existing customer profile

The error is saiding amount is required and it should be before customerprofileid.


look at the public void setUp()

order = Order.createOrder();





Posts: 1
Registered: ‎12-11-2019

Re: CIM java code for charging an existing customer profile

We were able to successfully use the invoice number in Java.


Look under OrderType.  You can set both Invoice Number (as invoiceNum) and a Description (as decription).  Here is the piece of our code where we set it.


// Create the payment transaction request
        TransactionRequestType txnRequest = new TransactionRequestType();
        txnRequest.setAmount(new BigDecimal(amountTotal).setScale(2, RoundingMode.CEILING));
        OrderType ot=new OrderType();
        ot.setInvoiceNumber("Put Your Invoice Number Here");
        ot.setDescription("A description of the transaction");
        ArrayOfLineItem lineItemsArray = new ArrayOfLineItem();
            List<LineItemType> lineItems = lineItemsArray.getLineItem();
            LineItemType line1 = new LineItemType();
            line1.setName("Some Detail");
            line1.setDescription("Some Detail Description");
            line1.setQuantity( BigDecimal.valueOf( 1 ) );
            line1.setTaxable( false );
            line1.setUnitPrice( BigDecimal.valueOf(amount) );
            lineItems.add( line1 );
            LineItemType line2 = new LineItemType();
            line2.setName("Another Item");
            line2.setDescription("Another description for the 2nd item");
            line2.setQuantity( BigDecimal.valueOf( 1 ) );
            line2.setTaxable( false );
            line2.setUnitPrice( BigDecimal.valueOf(adminfee) );
            lineItems.add( line2 );