cancel
Showing results for 
Search instead for 
Did you mean: 

Payment profile looping in CIM

I am confused a bit on the looping of the paymentProfile / CustomerPaymentProfileType blocks and how to properly create a datastructure for the example php code.

Before I knew what the hell I was doing, i created a simple customer profile with just single object for the payment profiles under the CreateCustomerProfile->profile->paymentProfiles->CustomerPaymentProfileType and it seemed to work.

Later I noticed in the code that this was supposed to be a looping structure so I built my object to create an array at the CustomerPaymentProfile level and successfully used it to send requests with multiple payment profiles (although i cannot recall off hand if I was testing 'CreateCustomerProfile or CreateCustomerPaymentProfile requests)

Well I started to integrate my back-end soap object into Zend this week and was back to just attaching a single payment profile to a create request and it pukes if it's in a single-element array.

So how is that looping supposed to be handled for requests that only have a single payment profile?  This is what an empty structure looks like from my object model:

=============================CreateCustomerProfile==============================
===============
   PHP data structure:
===============
CreateCustomerProfile::__set_state(array(
   'merchantAuthentication' => 
  MerchantAuthenticationType::__set_state(array(
     'name' => NULL,
     'transactionKey' => NULL,
  )),
   'merchantCustomerId' => NULL,
   'description' => NULL,
   'email' => NULL,
   'profile' => 
  CustomerProfileType::__set_state(array(
     'paymentProfiles' => 
    ArrayOfCustomerPaymentProfileType::__set_state(array(
       'CustomerPaymentProfileType' => 
      array (
        0 => 
        CustomerPaymentProfileType::__set_state(array(
           'payment' => 
          PaymentType::__set_state(array(
             'creditCard' => 
            CreditCardType::__set_state(array(
               'cardCode' => NULL,
               'cardNumber' => NULL,
               'expirationDate' => NULL,
            )),
          )),
           'driversLicense' => 
          DriversLicenseType::__set_state(array(
             'number' => NULL,
             'dateOfBirth' => NULL,
             'state' => NULL,
          )),
           'taxId' => NULL,
           'customerType' => NULL,
           'billTo' => 
          CustomerAddressType::__set_state(array(
             'phoneNumber' => NULL,
             'faxNumber' => NULL,
             'firstName' => NULL,
             'lastName' => NULL,
             'company' => NULL,
             'address' => NULL,
             'city' => NULL,
             'state' => NULL,
             'zip' => NULL,
             'country' => NULL,
          )),
        )),
      ),
    )),
     'shipToList' => 
    ArrayOfCustomerAddressType::__set_state(array(
       'CustomerAddressType' => 
      array (
        0 => 
        CustomerAddressType::__set_state(array(
           'phoneNumber' => NULL,
           'faxNumber' => NULL,
           'firstName' => NULL,
           'lastName' => NULL,
           'company' => NULL,
           'address' => NULL,
           'city' => NULL,
           'state' => NULL,
           'zip' => NULL,
           'country' => NULL,
        )),
      ),
    )),
  )),
   'validationMode' => NULL,
)) 

It would only work when I dropped the CustomerPaymentProfileType and dropped it down in place of the ArrayOf... level for a single payment profile.  What am I missing here?

 

treii28
Contributor
1 REPLY 1

Hi treii28,


It doesn't look like anyone has responded yet, but someone still may have feedback on your question. We recommend subscribing to this topic so that you'll be alerted via email if anyone else from the community is able to respond with any comments. To subscribe, click Topic Options at the top of this thread and then select Subscribe. You'll then receive an email once anyone replies to your post.

 

Thanks,

 

David
Authorize.Net

David
Administrator Administrator
Administrator