def get_purchase_params(cart, callback_url=None, extra_data=None):
 total_cost = cart.total_cost
 amount = '{0:0.2f}'.format(total_cost)
 params = OrderedDict()
 params['amount'] = amount
 params['currency'] = cart.currency
 params['orderNumber'] = 'OrderId: {0:d}'.format(cart.id)
 params['access_key'] = get_processor_config().get('ACCESS_KEY', '')
 params['profile_id'] = get_processor_config().get('PROFILE_ID', '')
 params['reference_number'] = cart.id
 params['transaction_type'] = 'sale'
 params['locale'] = 'en'
 params['signed_date_time'] = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
 params['signed_field_names'] = 'access_key,profile_id,amount,currency,transaction_type,reference_number,signed_date_time,locale,transaction_uuid,signed_field_names,unsigned_field_names,orderNumber'
 params['unsigned_field_names'] = ''
 params['transaction_uuid'] = uuid.uuid4().hex
 params['payment_method'] = 'card'
 if (callback_url is not None):
  params['override_custom_receipt_page'] = callback_url
  params['override_custom_cancel_page'] = callback_url
 if (extra_data is not None):
  for (num, item) in enumerate(extra_data, start=1):
   key = u'merchant_defined_data{num}'.format(num=num)
   params[key] = item
 return params

def get_purchase_params ( cart , callback_url = None , extra_data = None ) : total_cost = cart . total_cost amount = '{0:0.2f}' . format ( total_cost ) params = OrderedDict ( ) params [ 'amount' ] = amount params [ 'currency' ] = cart . currency params [ 'orderNumber' ] = 'OrderId: {0:d}' . format ( cart . id ) params [ 'access_key' ] = get_processor_config ( ) . get ( 'ACCESS_KEY' , '' ) params [ 'profile_id' ] = get_processor_config ( ) . get ( 'PROFILE_ID' , '' ) params [ 'reference_number' ] = cart . id params [ 'transaction_type' ] = 'sale' params [ 'locale' ] = 'en' params [ 'signed_date_time' ] = datetime . utcnow ( ) . strftime ( '%Y-%m-%dT%H:%M:%SZ' ) params [ 'signed_field_names' ] = 'access_key,profile_id,amount,currency,transaction_type,reference_number,signed_date_time,locale,transaction_uuid,signed_field_names,unsigned_field_names,orderNumber' params [ 'unsigned_field_names' ] = '' params [ 'transaction_uuid' ] = uuid . uuid4 ( ) . hex params [ 'payment_method' ] = 'card' if ( callback_url is not None ) : params [ 'override_custom_receipt_page' ] = callback_url params [ 'override_custom_cancel_page' ] = callback_url if ( extra_data is not None ) : for ( num , item ) in enumerate ( extra_data , start = 1 ) : key = u'merchant_defined_data{num}' . format ( num = num ) params [ key ] = item return params
this method will build out a dictionary of parameters needed by cybersource to complete the transaction args: cart : the order model representing items in the users cart .