code: private long doDiameterCharging(String sessionId, String userId, Long cost, boolean refund)
    {
      try
      {
        logger.info( "Creating Diameter Charging " + (refund ? "Refund" : "Debit") + " Request UserId[" + userId + "], Cost[" + cost + "]..." );
        Request req = (Request) diameterBaseClient.createAccountingRequest( sessionId, userId, cost, refund );
        
        logger.info( "Sending Diameter Charging " + (refund ? "Refund" : "Debit") + " Request..." );
        Message msg = diameterBaseClient.sendMessageSync( req );
  
        long resultCode = -1;
        
        if(msg instanceof Answer)
          resultCode = ((Answer)msg).getResultCode().getUnsigned32();
        
        return resultCode;
      }
      catch ( Exception e )
      {
        logger.error( "Failure communicating with Diameter Charging Server.", e );
        return 5012;
      }   
    }
docs: Method for doing the Charging, either it's a debit or a refund.
  
  @param sessionId the Session-Id for the Diameter Message
  @param userId the User-Id of the client in the Diameter Server
  @param cost the Cost (or Refund value) of the service
  @param refund boolean indicating if it's a refund or not
  @return a long with the Result-Code AVP from the Answer