Reply
Highlighted
Contributor
Posts: 37
Registered: ‎11-13-2017

Create Profile Using Charge a Credit card API

Hi,

i was trying to create customer profile (along with customer payment profile) on invoking "Charge a Credit Card" API.

CustomerProfilePaymentType customerProfilePaymentType = new CustomerProfilePaymentType();
    		
    		Boolean isCreateProfile = true;
    		
    		customerProfilePaymentType.setCreateProfile(isCreateProfile);
    		// Create the payment transaction request
    		TransactionRequestType txnRequest = new TransactionRequestType();
    		txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
    		txnRequest.setPayment(paymentType);
    		txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
    		
    		txnRequest.setProfile(customerProfilePaymentType);

my payment was successfull, but failed to create a profile. am getting an error "One or more fields must contain a value".

I want to know how to set those fields in java code.

kindly help me in this.


Thanks,

Suresh Babu R

Highlighted
Authorize.Net Developer
Posts: 3
Registered: ‎11-26-2017

Re: Create Profile Using Charge a Credit card API

[ Edited ]

Hi ,

 

For charge credit card transaction please refer to the charge credit card in the sample code.

You need to set up the customer (CustomerDataType) field in the transactionRequest for creating a customer profile (otherwise you'll get a 'customer info is missing' error).  Also make sure your paymentType has all the required fields.