You are here

function commerce_authnet_cim_credit_card_array in Commerce Authorize.Net 7

Generates a creditCard array for CIM API requests.

Parameters

$payment_details: An array of payment details used in a CIM API request that doesn't have to include credit card data. If it does, the following keys are expected:

  • cardNumber: the full credit card number
  • expirationDate: the expiration date in YYYY-MM format
  • cardCode: the three or four digit card security code
2 calls to commerce_authnet_cim_credit_card_array()
commerce_authnet_cim_create_customer_payment_profile_request in ./commerce_authnet.module
Submits a createCustomerPaymentProfileRequest XML CIM API request to Authorize.Net.
commerce_authnet_cim_create_customer_profile_request in ./commerce_authnet.module
Submits a createCustomerProfileRequest XML CIM API request to Authorize.Net.

File

./commerce_authnet.module, line 1553
Implements Authorize.Net payment services for use in Drupal Commerce.

Code

function commerce_authnet_cim_credit_card_array($payment_details) {
  $credit_card = array();
  foreach (array(
    'cardNumber',
    'expirationDate',
    'cardCode',
  ) as $key) {
    if (!empty($payment_details[$key])) {
      $credit_card[$key] = $payment_details[$key];
    }
  }
  return $credit_card;
}